HTTPResponse Class Reference

#include <HTTPResponse.h>

Inheritance diagram for HTTPResponse:

Inheritance graph
[legend]
Collaboration diagram for HTTPResponse:

Collaboration graph
[legend]
List of all members.

Accessors

virtual string get_protocol () const
virtual int get_status () const
virtual FILE * get_stream () const
virtual ObjectType get_type () const
virtual string get_version () const

Mutators

virtual void set_protocol (const string &p)
virtual void set_status (int s)
virtual void set_stream (FILE *s)
virtual void set_type (ObjectType o)
virtual void set_version (const string &v)

Public Member Functions

 HTTPResponse (FILE *s, vector< string > *h, const string &temp_file)
virtual ~HTTPResponse ()

Protected Member Functions

Suppressed default methods
 HTTPResponse (const HTTPResponse &rs)
 HTTPResponse ()
HTTPResponseoperator= (const HTTPResponse &)

Detailed Description

Encapsulate an http response. Instead of directly returning the FILE pointer from which a response is read and vector of headers, return an instance of this object.

Todo:
Maybe refactor so that the header parsing code is hear and not in HTTPConnect?

Definition at line 53 of file HTTPResponse.h.


Constructor & Destructor Documentation

HTTPResponse::HTTPResponse (  )  [inline, protected]

Definition at line 62 of file HTTPResponse.h.

HTTPResponse::HTTPResponse ( const HTTPResponse rs  )  [inline, protected]

Definition at line 64 of file HTTPResponse.h.

HTTPResponse::HTTPResponse ( FILE *  s,
vector< string > *  h,
const string &  temp_file 
) [inline]

Build an HTTPResponse object. An instance of this class is used to return an HTTP response (body and headers). If the response is really from a remote server, the current HTTP code stores the body in a temporary file and the headers in a vector<string> object. This class will delete those resources when its destructor is called. If the response does not have a temporary file that needs to be deleted (say it actually comes from a local cache or was read directly into memory), the temp file should be set to "".

Parameters:
s FILE * to the response. Read the response body from this stream.
h Response headers. This class will delete the pointer when the instance that contains it is destroyed.
temp_file Name a the temporary file that holds the response body; this file is deleted when this instance is deleted.

Definition at line 88 of file HTTPResponse.h.

References DBG, and DBGN.

virtual HTTPResponse::~HTTPResponse (  )  [inline, virtual]

When an instance is destroyed, free the temporary resources: the temp_file and headers are deleted. If the tmp file name is "", it is not deleted.

Definition at line 100 of file HTTPResponse.h.

References close_temp(), DBG, DBGN, dods_keep_temps, Response::get_stream(), and Response::set_stream().

Here is the call graph for this function:


Member Function Documentation

virtual vector<string>* HTTPResponse::get_headers (  )  const [inline, virtual]

Definition at line 115 of file HTTPResponse.h.

Referenced by HTTPConnect::fetch_url().

virtual string Response::get_protocol (  )  const [inline, virtual, inherited]

Definition at line 113 of file Response.h.

Referenced by Connect::read_data_no_mime(), Connect::request_das(), Connect::request_das_url(), Connect::request_data(), Connect::request_data_url(), Connect::request_dds(), Connect::request_dds_url(), Connect::request_ddx(), Connect::request_ddx_url(), Connect::request_protocol(), and Connect::request_version().

virtual int Response::get_status (  )  const [inline, virtual, inherited]

Definition at line 97 of file Response.h.

virtual FILE* Response::get_stream (  )  const [inline, virtual, inherited]

Reimplemented in PipeResponse, and StdinResponse.

Definition at line 101 of file Response.h.

Referenced by main(), Connect::request_das(), Connect::request_das_url(), Connect::request_dds(), Connect::request_dds_url(), Connect::request_ddx(), Connect::request_ddx_url(), HTTPCacheResponse::~HTTPCacheResponse(), and ~HTTPResponse().

virtual ObjectType Response::get_type (  )  const [inline, virtual, inherited]

Definition at line 105 of file Response.h.

Referenced by Connect::request_das(), Connect::request_das_url(), Connect::request_dds(), Connect::request_dds_url(), Connect::request_ddx(), and Connect::request_ddx_url().

virtual string Response::get_version (  )  const [inline, virtual, inherited]

Definition at line 109 of file Response.h.

Referenced by Connect::read_data_no_mime(), Connect::request_das(), Connect::request_das_url(), Connect::request_data(), Connect::request_data_url(), Connect::request_dds(), Connect::request_dds_url(), Connect::request_ddx(), Connect::request_ddx_url(), Connect::request_protocol(), and Connect::request_version().

HTTPResponse& HTTPResponse::operator= ( const HTTPResponse  )  [inline, protected]

Definition at line 66 of file HTTPResponse.h.

virtual void HTTPResponse::set_headers ( vector< string > *  h  )  [inline, virtual]

Definition at line 123 of file HTTPResponse.h.

virtual void Response::set_protocol ( const string &  p  )  [inline, virtual, inherited]

Definition at line 137 of file Response.h.

Referenced by HTTPConnect::fetch_url().

virtual void Response::set_status ( int  s  )  [inline, virtual, inherited]

Definition at line 121 of file Response.h.

virtual void Response::set_stream ( FILE *  s  )  [inline, virtual, inherited]

Reimplemented in PipeResponse, and StdinResponse.

Definition at line 125 of file Response.h.

Referenced by ~HTTPResponse().

virtual void Response::set_type ( ObjectType  o  )  [inline, virtual, inherited]

Definition at line 129 of file Response.h.

Referenced by HTTPConnect::fetch_url().

virtual void Response::set_version ( const string &  v  )  [inline, virtual, inherited]

Definition at line 133 of file Response.h.

Referenced by HTTPConnect::fetch_url().


The documentation for this class was generated from the following file:
Generated on Wed Jun 27 12:58:03 2007 for libdap++ by  doxygen 1.4.7