/* $Revision: 42 $ $Date: 10/07/06 13:46 $ Copyright © 2007, FSL Technologies Limited. Contact "http://fost.3.felspar.com". */ #include "stdafx.h" #include "FOST.com.hpp" using namespace FSLib; namespace { Revision c_revision( L"$Archive: /FOST.3/F3Base/FSLibUser.cpp $", __DATE__, L"$Revision: 42 $", L"$Date: 10/07/06 13:46 $" ); } /* FSLib::IISPageHandler::InputServer */ FSLib::Iis::InputServer::InputServer( ATL::CComPtr< IRequest > r ) : m_request( r ) { } size_t FSLib::Iis::InputServer::exists( const FSLib::wstring &n, const FSLib::Nullable< FSLib::wstring > & ) const { IStringList *slist = NULL; try { _variant_t v( value( n ) ); if ( v.vt == VT_DISPATCH ) { v.pdispVal->QueryInterface( __uuidof( IStringList ), reinterpret_cast< void ** >( &slist ) ); if ( slist == NULL ) { throw FSLib::Exceptions::ComError( L"Failed to find an IStringList in the server variable collection" ); } else { int c( 0 ); if ( FAILED( slist->get_Count( &c ) ) ) throw FSLib::Exceptions::ComError( L"Failed to fetch count from InputServer" ); return c; } } else { throw FSLib::Exceptions::ComError( L"Failed to find a VT_DISPATCH in the server variables collection" ); } } catch ( ... ) { if ( slist != NULL ) slist->Release(); throw; } } _variant_t FSLib::Iis::InputServer::value( const FSLib::wstring &name, const Nullable< size_t > &num, const FSLib::Nullable< FSLib::wstring > & ) const { if ( !num.isnull() && num.value() ) throw FSLib::Exceptions::OutOfRange< __int64 >( L"May not request a value for beyond index 0 in from an InputServer", 0, 1, num.value() ); _variant_t value; if ( FAILED( server()->get_Item( _variant_t( name.c_str() ), &value ) ) ) throw FSLib::Exceptions::Field( L"Failed to get Server variable field", name ); return value; } IRequestDictionary *FSLib::Iis::InputServer::server() const { if ( m_server.get() == NULL ) if ( FAILED( m_request->get_ServerVariables( &(m_server.get()) ) ) ) throw FSLib::Exceptions::Field( L"Could not find server data in the request" ); return m_server.get(); }