#include <HTTP_Client.h>
Collaboration diagram for TAO_HTTP_Client:
Public Member Functions | |
TAO_HTTP_Client (void) | |
~TAO_HTTP_Client (void) | |
int | open (const ACE_TCHAR *filename, const ACE_TCHAR *hostname=ACE_DEFAULT_SERVER_HOST, u_short port=80) |
int | read (ACE_Message_Block *mb) |
int | close () |
Frees memory allocated for filename. | |
Private Attributes | |
ACE_INET_Addr | inet_addr_ |
Store the internet address of the server. | |
ACE_TCHAR * | filename_ |
The filename. | |
ACE_Connector< TAO_HTTP_Handler, ACE_SOCK_CONNECTOR > | connector_ |
The connector endpoint to initiate the client connection. |
This class provides the ability to retrieve data from the network, of specified length and offset, and potentially use any protocol "under the hood" to do so. It currently uses HTTP. See HTTP_Handler also.
Definition at line 52 of file HTTP_Client.h.
|
Definition at line 12 of file HTTP_Client.cpp.
00013 { 00014 } |
|
Definition at line 16 of file HTTP_Client.cpp. References close().
00017 { 00018 this->close (); 00019 } |
|
Frees memory allocated for filename.
Definition at line 49 of file HTTP_Client.cpp. References ACE_OS::free(). Referenced by TAO_HTTP_Parser::parse_string(), and ~TAO_HTTP_Client().
00050 { 00051 if (this->filename_) 00052 { 00053 ACE_OS::free ((void *) this->filename_); 00054 this->filename_ = 0; 00055 } 00056 return 0; 00057 } |
|
Initializes the class with the given filename, hostname and port. it should be called with the filename, before any read/write calls Definition at line 22 of file HTTP_Client.cpp. References ACE_INET_Addr::set(), and ACE_OS::strdup(). Referenced by TAO_HTTP_Parser::parse_string().
00025 { 00026 this->filename_ = ACE_OS::strdup (filename); 00027 this->inet_addr_.set (port, hostname); 00028 return 0; 00029 } |
|
Starts a connection, and reads a file from the server into Message_Block mb Definition at line 32 of file HTTP_Client.cpp. References ACE_ERROR_RETURN, TAO_HTTP_Handler::byte_count(), ACE_Connector< TAO_HTTP_Handler, ACE_SOCK_CONNECTOR >::connect(), and LM_ERROR. Referenced by TAO_HTTP_Parser::parse_string().
00033 { 00034 // Create a HTTP_Client Reader 00035 TAO_HTTP_Reader HTTP_reader (mb, this->filename_); 00036 TAO_HTTP_Handler *brp = &HTTP_reader; 00037 00038 // Connect to the server 00039 if (connector_.connect (brp, this->inet_addr_) == -1) 00040 { 00041 ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "TAO_HTTP_Client::read(): Connector error\n"), -1); 00042 } 00043 00044 return HTTP_reader.byte_count (); 00045 00046 } |
|
The connector endpoint to initiate the client connection.
Definition at line 79 of file HTTP_Client.h. |
|
The filename.
Definition at line 76 of file HTTP_Client.h. |
|
Store the internet address of the server.
Definition at line 73 of file HTTP_Client.h. |