Savarese Software Research Corporation
HTTPResponse Struct Reference

Abstract class defining the interface for a response to an HTTP request. More...

#include <HTTPResponse.h>

Inheritance diagram for HTTPResponse:

List of all members.

Public Member Functions

virtual ~HTTPResponse ()
virtual void complete (const char *content=0, const unsigned int content_length=0, bool cache_disable=CacheEnable)=0
 Completes the response, rendering the response to the client.
virtual bool completed () const =0
 Returns true if the response has completed, false if not.
virtual void suspend ()=0
 Suspends the response, indicating it will be completed later via a continuation.
virtual void resume ()=0
 Resumes the response, indicating it is being continued via a continuation.
virtual bool suspended () const =0
 Returns true if the response has been suspended for later completion, false if not.
virtual void send_error (const HTTPStatusCode status)=0
 Sends the specified status code and renders a basic error page.
virtual void send_redirect (const string &redirect)=0
 Redirects the client to a new URL.
virtual void set_content_type (const string &type)=0
 Sets the content type of the response.
virtual const stringcontent_type () const =0
 Returns the content type previously set by set_contetn_type(const string & type).
virtual void set_status (const HTTPStatusCode status)=0
 Sets the status code for the response.
virtual HTTPStatusCode status () const =0
 Returns the status code previously set by set_status(const HTTPStatus code).
virtual void set_session_id (const string &session_id, const unsigned int max_age=1, const bool secure=false)=0
 Sets the session id to store on the client.
virtual void clear_session_id ()=0
 Instructs the client to expire the current session id.
virtual const stringsession_id () const =0
 Returns either the session id provided with the original request or the session id that will be sent back to the client.

Detailed Description

Abstract class defining the interface for a response to an HTTP request.

Definition at line 68 of file HTTPResponse.h.


Constructor & Destructor Documentation

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

Definition at line 70 of file HTTPResponse.h.


Member Function Documentation

virtual void HTTPResponse::clear_session_id ( ) [pure virtual]

Instructs the client to expire the current session id.

Implemented in FCGIResponse.

virtual void HTTPResponse::complete ( const char *  content = 0,
const unsigned int  content_length = 0,
bool  cache_disable = CacheEnable 
) [pure virtual]

Completes the response, rendering the response to the client.

Parameters:
contentA pointer to final data to send to client.
content_lengthLength of final content to send to client.
cache_disableSpecifies whether or not the client should cache output. A value of CacheDisable disables caching and CacheEnable enables caching.

Implemented in FCGIResponse.

virtual bool HTTPResponse::completed ( ) const [pure virtual]

Returns true if the response has completed, false if not.

Returns:
True if the response has completed, false if not.

Implemented in FCGIResponse.

virtual const string& HTTPResponse::content_type ( ) const [pure virtual]

Returns the content type previously set by set_contetn_type(const string & type).

The initial value is text/html.

Returns:
The content type previously set by set_contetn_type(const string & type).

Implemented in FCGIResponse.

virtual void HTTPResponse::resume ( ) [pure virtual]

Resumes the response, indicating it is being continued via a continuation.

Implemented in FCGIResponse.

virtual void HTTPResponse::send_error ( const HTTPStatusCode  status) [pure virtual]

Sends the specified status code and renders a basic error page.

Parameters:
statusThe status code to send.

Implemented in FCGIResponse.

virtual void HTTPResponse::send_redirect ( const string redirect) [pure virtual]

Redirects the client to a new URL.

If the redirect target is not an absolute URL, it is converted to an absolute URL based on the original request URI. A relative path with no leading / will interpret the original request URI as a parent path. Therefore, if you're redirecting a request URI that does not map to a directory, you should calculate the parent path and create a path with a leading / from it.

Parameters:
redirectThe relative, or absolute URL of the redirect target.

Implemented in FCGIResponse.

virtual const string& HTTPResponse::session_id ( ) const [pure virtual]

Returns either the session id provided with the original request or the session id that will be sent back to the client.

If no session id was provided by the client and no session id has been set via set_sesion_id(const string &), it returns an empty string. Otherwise it returns the session id provided by the client if set_session_id has not been called, else the id set via set_session_id.

Returns:
The sesion id provided with the original request or set via set_session_id.

Implemented in FCGIResponse.

virtual void HTTPResponse::set_content_type ( const string type) [pure virtual]

Sets the content type of the response.

In general, this method should be used only for responses that aren't text/html.

Parameters:
typeThe content type to set.

Implemented in FCGIResponse.

virtual void HTTPResponse::set_session_id ( const string session_id,
const unsigned int  max_age = 1,
const bool  secure = false 
) [pure virtual]

Sets the session id to store on the client.

Parameters:
session_idThe new session id to set.
max_ageThe lifetime of the cookie in seconds. A value of 1 is interpreted specially to mean the cookie expires when the user agent terminates.

Implemented in FCGIResponse.

virtual void HTTPResponse::set_status ( const HTTPStatusCode  status) [pure virtual]

Sets the status code for the response.

In general, this method should be used only for responses that don't constitute errors. To render an error page along with an error status, you should use send_error(const HTTPStatusCode).

Parameters:
statusThe status code to set.

Implemented in FCGIResponse.

virtual HTTPStatusCode HTTPResponse::status ( ) const [pure virtual]

Returns the status code previously set by set_status(const HTTPStatus code).

The initial value is StatusOK.

Returns:
The status code previously set by set_status(const HTTPStatus code).

Implemented in FCGIResponse.

virtual void HTTPResponse::suspend ( ) [pure virtual]

Suspends the response, indicating it will be completed later via a continuation.

Implemented in FCGIResponse.

virtual bool HTTPResponse::suspended ( ) const [pure virtual]

Returns true if the response has been suspended for later completion, false if not.

Returns:
True if the response has been suspended for later completion, false if not.

Implemented in FCGIResponse.


The documentation for this struct was generated from the following file:

Savarese Software Research Corporation
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.