Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

HttpResponse Class Reference

Inheritance diagram for HttpResponse:

HttpMessage ServletResponse List of all members.

Public Member Functions

 this (IProviderBridge bridge)
void reset ()
void sendError (inout HttpStatus status)
void sendError (inout HttpStatus status, char[] msg)
void sendError (inout HttpStatus status, Exception ex)
void setStatus (inout HttpStatus status)
HttpStatus getStatus ()
HttpWriter getWriter ()
HttpMutableParams getOutputParams ()
HttpMutableCookies getOutputCookies ()
HttpMutableHeaders getOutputHeaders ()
IBuffer getOutputBuffer ()
void sendRedirect (char[] location)
void write (IWriter writer)
void flush (IWriter writer)

Static Public Member Functions

 this ()

Private Member Functions

void commit (IWriter writer)
void sendError (inout HttpStatus status, char[] reason, char[] message)
 this (IProviderBridge bridge, IBuffer headerSpace)
void setConduit (IConduit conduit)
final IConduit getConduit ()
final IBuffer getBuffer ()
final HttpMutableHeaders getHeader ()
final IProviderBridge getBridge ()
char[] getEncoding ()
char[] getMimeType ()
void setContentType (char[] type)
char[] getContentType ()
void setMimeAndEncoding (char[] type)

Private Attributes

HttpMutableParams params
HttpMutableCookies cookies
HttpStatus status
HttpWriter writer
bool commited

Static Private Attributes

InvalidStateException InvalidState

Detailed Description

Define an http response to a user-agent (client). Note that all data is managed on a thread-by-thread basis.

Definition at line 182 of file HttpResponse.d.


Member Function Documentation

this  )  [inline, static]
 

Construct static instances of exceptions etc.

Definition at line 198 of file HttpResponse.d.

this IProviderBridge  bridge  )  [inline]
 

Create a Response instance. Note that we create a bunch of internal support objects on a per-thread basis. This is so we don't have to create them on demand; however, we should be careful about resetting them all before each new usage.

Reimplemented in ServletResponse.

Definition at line 212 of file HttpResponse.d.

References Buffer, HeaderBufferSize, HttpWriter, and ParamsBufferSize.

void reset  )  [inline]
 

Reset this response, ready for the next connection

Reimplemented from HttpMessage.

Reimplemented in ServletResponse.

Definition at line 236 of file HttpResponse.d.

References commited, and setStatus().

Referenced by HttpBridge::cross().

void sendError inout HttpStatus  status  )  [inline]
 

Send an error status to the user-agent

Reimplemented in ServletResponse.

Definition at line 255 of file HttpResponse.d.

Referenced by sendError(), and testHttpServer().

void sendError inout HttpStatus  status,
char[]  msg
[inline]
 

Send an error status to the user-agent, along with the provided message

Reimplemented in ServletResponse.

Definition at line 267 of file HttpResponse.d.

References sendError().

void sendError inout HttpStatus  status,
Exception  ex
[inline]
 

Send an error status to the user-agent, along with the provided exception text

Definition at line 279 of file HttpResponse.d.

References sendError().

void setStatus inout HttpStatus  status  )  [inline]
 

Set the current response status.

Reimplemented in ServletResponse.

Definition at line 290 of file HttpResponse.d.

Referenced by reset(), sendError(), and sendRedirect().

HttpStatus getStatus  )  [inline]
 

Return the current response status

Definition at line 301 of file HttpResponse.d.

HttpWriter getWriter  )  [inline]
 

Return the output writer. This set a sentinel indicating that we cannot add any more headers (since they have to be flushed before any additional output is sent).

Reimplemented in ServletResponse.

Definition at line 314 of file HttpResponse.d.

References commit().

HttpMutableParams getOutputParams  )  [inline]
 

Return the wrapper for adding output parameters

Definition at line 328 of file HttpResponse.d.

HttpMutableCookies getOutputCookies  )  [inline]
 

Return the wrapper for output cookies

Definition at line 339 of file HttpResponse.d.

HttpMutableHeaders getOutputHeaders  )  [inline]
 

Return the wrapper for output headers.

Definition at line 350 of file HttpResponse.d.

References commited.

IBuffer getOutputBuffer  )  [inline]
 

Return the buffer attached to the output conduit. Note that further additions to the output headers is disabled from this point forward.

Definition at line 366 of file HttpResponse.d.

References commit().

void sendRedirect char[]  location  )  [inline]
 

Send a redirect response to the user-agent

Reimplemented in ServletResponse.

Definition at line 380 of file HttpResponse.d.

References HttpMutableHeaders::add(), flush(), HttpMessage::getHeader(), and setStatus().

void write IWriter  writer  )  [inline]
 

Write the response and the output headers

Reimplemented from HttpMessage.

Definition at line 393 of file HttpResponse.d.

References commit().

void flush IWriter  writer  )  [inline]
 

Ensure the output is flushed

Definition at line 404 of file HttpResponse.d.

References commit(), IWriter::flush(), and version.

Referenced by sendError(), sendRedirect(), and ServletProvider::service().

void commit IWriter  writer  )  [inline, private]
 

Private method to send the response status, and the output headers, back to the user-agent

Definition at line 424 of file HttpResponse.d.

References HttpMutableHeaders::add(), HttpStatus::code, commited, IWriter::cr(), IWriter::flush(), HttpHeaders::get(), HttpMessage::getHeader(), HttpStatus::name, IWriter::put(), and version.

Referenced by flush(), getOutputBuffer(), getWriter(), sendError(), and write().

void sendError inout HttpStatus  status,
char[]  reason,
char[]  message
[inline, private]
 

Send an error back to the user-agent. We have to be careful about which errors actually have content returned and those that don't.

Definition at line 475 of file HttpResponse.d.

References commit(), flush(), HttpMessage::setContentType(), and setStatus().

this IProviderBridge  bridge,
IBuffer  headerSpace
[inline, inherited]
 

Construct this HttpMessage using the specified HttpBridge. The bridge provides a gateway to both the server and provider (servicer) instances.

Definition at line 100 of file HttpMessage.d.

References HttpMessage::bridge, and Buffer.

void setConduit IConduit  conduit  )  [inline, inherited]
 

Set the IConduit used by this message; typically this is the SocketConduit instantiated in response to a connection request.

Given that the HttpMessage remains live (on a per-thread basis), this method will be called for each connection request.

Definition at line 140 of file HttpMessage.d.

References Buffer::clear(), and Buffer::setConduit().

Referenced by HttpBridge::cross().

final IConduit getConduit  )  [inline, protected, inherited]
 

Return the IConduit in use

Definition at line 152 of file HttpMessage.d.

References Buffer::getConduit().

Referenced by HttpRequest::getRemoteAddr(), and HttpRequest::getRemoteHost().

final IBuffer getBuffer  )  [inline, protected, inherited]
 

Return the buffer bound to our conduit

Definition at line 163 of file HttpMessage.d.

final HttpMutableHeaders getHeader  )  [inline, protected, inherited]
 

Return the HttpHeaders wrapper

Definition at line 174 of file HttpMessage.d.

Referenced by commit(), HttpRequest::getHost(), HttpRequest::getInputHeaders(), HttpRequest::readHeaders(), sendRedirect(), ServletResponse::setContentLength(), and HttpRequest::this().

final IProviderBridge getBridge  )  [inline, protected, inherited]
 

Return the bridge used by the this message

Definition at line 185 of file HttpMessage.d.

References HttpMessage::bridge.

Referenced by HttpRequest::getHost(), HttpRequest::getPort(), HttpRequest::getRemoteAddr(), HttpRequest::getRemoteHost(), and HttpRequest::getServerScheme().

char [] getEncoding  )  [inline, inherited]
 

Return the encoding string

Reimplemented in HttpRequest.

Definition at line 196 of file HttpMessage.d.

References HttpMessage::encoding.

char [] getMimeType  )  [inline, inherited]
 

Return the mime-type in use

Reimplemented in HttpRequest.

Definition at line 207 of file HttpMessage.d.

References HttpMessage::mimeType.

void setContentType char[]  type  )  [inline, inherited]
 

Set the content-type header, and parse it for encoding and mime-tpye information.

Reimplemented in ServletResponse.

Definition at line 219 of file HttpMessage.d.

References HttpMutableHeaders::add(), and HttpMessage::setMimeAndEncoding().

Referenced by sendError().

char [] getContentType  )  [inline, inherited]
 

Return the content-type from the headers.

Reimplemented in ServletRequest.

Definition at line 231 of file HttpMessage.d.

References HttpHeaders::get().

void setMimeAndEncoding char[]  type  )  [inline, protected, inherited]
 

Parse a text string looking for encoding and mime information

Definition at line 242 of file HttpMessage.d.

References HttpMessage::encoding, and HttpMessage::mimeType.

Referenced by HttpRequest::getMimeType(), and HttpMessage::setContentType().


Member Data Documentation

HttpMutableParams params [private]
 

Definition at line 184 of file HttpResponse.d.

HttpMutableCookies cookies [private]
 

Definition at line 185 of file HttpResponse.d.

HttpStatus status [private]
 

Definition at line 186 of file HttpResponse.d.

HttpWriter writer [private]
 

Definition at line 187 of file HttpResponse.d.

bool commited [private]
 

Definition at line 188 of file HttpResponse.d.

Referenced by commit(), getOutputHeaders(), and reset().

InvalidStateException InvalidState [static, private]
 

Definition at line 190 of file HttpResponse.d.


The documentation for this class was generated from the following file:
Generated on Sun Nov 7 19:07:04 2004 for Mango by doxygen 1.3.6