00001 // $Id: FTP_URL.cpp 91118 2010-07-17 10:29:57Z mcorino $ 00002 00003 #include "ace/INet/FTP_URL.h" 00004 00005 #if !defined (__ACE_INLINE__) 00006 #include "ace/INet/FTP_URL.inl" 00007 #endif 00008 00009 #include "ace/INet/String_IOStream.h" 00010 #include "ace/INet/FTP_ClientRequestHandler.h" 00011 00012 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00013 00014 namespace ACE 00015 { 00016 namespace FTP 00017 { 00018 const char* URL::PROTOCOL = "ftp"; 00019 00020 const ACE_CString& URL::protocol () 00021 { 00022 static const ACE_CString protocol_ (PROTOCOL); 00023 return protocol_; 00024 } 00025 00026 URL::URL () 00027 : URL_INetAuthBase (FTP_PORT) 00028 { 00029 } 00030 00031 URL::URL (const ACE_CString& url_string) 00032 : URL_INetAuthBase (FTP_PORT) 00033 { 00034 this->parse (url_string); 00035 } 00036 00037 URL::URL (const URL& url) 00038 : URL_INetAuthBase (0) 00039 { 00040 *this = url; 00041 } 00042 00043 URL::~URL () 00044 { 00045 } 00046 00047 URL& URL::operator =(const URL& url) 00048 { 00049 this->set_user_info (url.get_user_info ()); 00050 this->set_host (url.get_host ()); 00051 this->set_port (url.get_port ()); 00052 this->set_path (url.get_path ()); 00053 return *this; 00054 } 00055 00056 ACE_CString URL::to_string () const 00057 { 00058 ACE::IOS::CString_OStream sos; 00059 sos << this->get_scheme () << "://" 00060 << this->get_authority ().c_str () 00061 << this->get_path ().c_str (); 00062 return sos.str (); 00063 } 00064 00065 ACE::INet::ClientRequestHandler* URL::create_default_request_handler () const 00066 { 00067 ACE::INet::ClientRequestHandler* prh = 0; 00068 ACE_NEW_NORETURN (prh, ClientRequestHandler ()); 00069 return prh; 00070 } 00071 00072 const URL::Factory& URL::factory_ = *URL::TURLFactorySingleton::instance (); 00073 00074 URL::Factory::Factory () 00075 { 00076 ACE::INet::URL_Base::register_factory (this); 00077 } 00078 00079 URL::Factory::~Factory () 00080 {} 00081 00082 const ACE_CString& URL::Factory::protocol () 00083 { 00084 return URL::protocol (); 00085 } 00086 00087 ACE::INet::URL_Base* URL::Factory::create_from_string (const ACE_CString& url_string) 00088 { 00089 URL* purl = 0; 00090 ACE_NEW_NORETURN (purl, URL (url_string)); 00091 return purl; 00092 } 00093 } 00094 } 00095 00096 ACE_END_VERSIONED_NAMESPACE_DECL