00001 // $Id: HTTP_Session.h 91118 2010-07-17 10:29:57Z mcorino $ 00002 00003 /** 00004 * @file HTTP_Session.h 00005 * 00006 * @author Martin Corino <mcorino@remedy.nl> 00007 */ 00008 00009 #ifndef ACE_HTTP_SESSION_H 00010 #define ACE_HTTP_SESSION_H 00011 00012 #include /**/ "ace/pre.h" 00013 00014 #include "ace/INet/HTTP_SessionBase.h" 00015 #include "ace/SOCK_Connector.h" 00016 #include "ace/INet/StreamHandler.h" 00017 #include "ace/INet/Sock_IOStream.h" 00018 00019 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00020 00021 namespace ACE 00022 { 00023 namespace HTTP 00024 { 00025 /** 00026 * @class ACE_HTTP_Session 00027 * 00028 * @brief Encapsulates HTTP session. 00029 * 00030 */ 00031 template <ACE_SYNCH_DECL> 00032 class Session_T : public SessionBase 00033 { 00034 public: 00035 typedef ACE::IOS::StreamHandler<ACE_SOCK_STREAM, ACE_SYNCH_USE> connection_type; 00036 00037 Session_T (bool keep_alive = false); 00038 00039 Session_T (const ACE_Time_Value& timeout, 00040 bool keep_alive = false, 00041 const ACE_Time_Value* alive_timeout = 0); 00042 00043 virtual ~Session_T (); 00044 00045 virtual bool is_connected () const; 00046 00047 bool attach_connection (connection_type* connection); 00048 00049 protected: 00050 00051 void close_connection (); 00052 00053 virtual bool connect_i (const ACE_Synch_Options& sync_opt); 00054 00055 virtual void close_i (); 00056 00057 virtual std::iostream& sock_stream (); 00058 00059 private: 00060 typedef ACE::IOS::Sock_IOStreamBase<ACE_SYNCH_USE> sock_stream_type; 00061 00062 connection_type* connection_; 00063 sock_stream_type* sock_stream_; 00064 }; 00065 00066 typedef Session_T<ACE_NULL_SYNCH> Session; 00067 } 00068 } 00069 00070 ACE_END_VERSIONED_NAMESPACE_DECL 00071 00072 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00073 #include "ace/INet/HTTP_Session.cpp" 00074 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00075 00076 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00077 #pragma implementation ("HTTP_Session.cpp") 00078 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00079 00080 #include /**/ "ace/post.h" 00081 #endif /* ACE_HTTP_SESSION_H */