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

HttpRequest Class Reference

Inheritance diagram for HttpRequest:

HttpMessage IWritable List of all members.

Public Member Functions

 this (IProviderBridge bridge)
void reset ()
StartLine getStartLine ()
Uri getRequestUri ()
Uri getExplicitUri ()
HttpReader getReader ()
HttpCookies getInputCookies ()
HttpHeaders getInputHeaders ()
HttpParams getInputParameters ()
IBuffer getInputBuffer ()
void write (IWriter writer)
void readHeaders ()
char[] getRemoteAddr ()
char[] getRemoteHost ()
char[] getServerScheme ()
char[] getEncoding ()
char[] getMimeType ()
int getPort ()
char[] getHost ()

Static Public Member Functions

 this ()

Private Member Functions

 this (IProviderBridge bridge, IBuffer headerSpace)
void setConduit (IConduit conduit)
final IConduit getConduit ()
final IBuffer getBuffer ()
final HttpMutableHeaders getHeader ()
final IProviderBridge getBridge ()
void setContentType (char[] type)
char[] getContentType ()
void setMimeAndEncoding (char[] type)

Private Attributes

int port
char[] host
bool mimed
bool uried
bool gulped
MutableUri uri
CompositeToken line
HttpReader reader
HttpParams params
HttpCookies cookies
StartLine startLine

Static Private Attributes

InvalidStateException InvalidState

Detailed Description

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

Definition at line 72 of file HttpRequest.d.


Member Function Documentation

this  )  [inline, static]
 

Setup exceptions and so on

Definition at line 96 of file HttpRequest.d.

References InvalidState.

this IProviderBridge  bridge  )  [inline]
 

Create a Request 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.

Definition at line 110 of file HttpRequest.d.

References HttpMessage::getHeader(), HttpCookies, HttpParams, HttpReader, params, and startLine.

void reset  )  [inline]
 

Reset this request, ready for the next connection

Reimplemented from HttpMessage.

Definition at line 142 of file HttpRequest.d.

References gulped, host, mimed, params, HttpCookies::reset(), HttpTokens::reset(), MutableUri::reset(), and uried.

Referenced by HttpBridge::cross().

StartLine getStartLine  )  [inline]
 

Return the HTTP startline from the connection request

Definition at line 162 of file HttpRequest.d.

References startLine.

Uri getRequestUri  )  [inline]
 

Return the request Uri as an immutable version ...

Definition at line 173 of file HttpRequest.d.

References Uri::getScheme(), getServerScheme(), MutableUri::parse(), MutableUri::setScheme(), startLine, and uried.

Referenced by getExplicitUri(), getHost(), and getInputParameters().

Uri getExplicitUri  )  [inline]
 

Ensure the uri has a host present. Return as an immutable

Definition at line 191 of file HttpRequest.d.

References getHost(), Uri::getHost(), getRequestUri(), and MutableUri::setHost().

HttpReader getReader  )  [inline]
 

Return the reader for the request input. This sets a boundary sentinel, indicating we're finished processing the input headers.

Definition at line 208 of file HttpRequest.d.

References gulped.

HttpCookies getInputCookies  )  [inline]
 

Return the set of parsed request cookies

Definition at line 221 of file HttpRequest.d.

References gulped, and InvalidState.

HttpHeaders getInputHeaders  )  [inline]
 

Return the set of parsed input headers

Definition at line 234 of file HttpRequest.d.

References HttpMessage::getHeader(), gulped, and InvalidState.

HttpParams getInputParameters  )  [inline]
 

Return the set of input parameters, from the query string and/or from POST data.

Definition at line 248 of file HttpRequest.d.

References Uri::decode(), IBuffer::get(), HttpHeaders::getInt(), Uri::getQuery(), getRequestUri(), HttpTokens::isParsed(), params, HttpParams::parse, startLine, and Text.

IBuffer getInputBuffer  )  [inline]
 

Return the buffer attached to the input conduit. This also sets a sentinel indicating we cannot read headers anymore.

Definition at line 292 of file HttpRequest.d.

References gulped.

void write IWriter  writer  )  [inline]
 

Write the startline and all input headers to the provider IWriter. This can be used for debug purposes.

Reimplemented from HttpMessage.

Definition at line 306 of file HttpRequest.d.

References startLine, and IWritable::write().

void readHeaders  )  [inline]
 

Parse all headers from the input.

Definition at line 318 of file HttpRequest.d.

References HttpMessage::getHeader(), CompositeToken::next(), HttpHeaders::parse, IBuffer::readable(), startLine, Stdout, and version.

Referenced by HttpBridge::cross().

char [] getRemoteAddr  )  [inline]
 

Proxy this request across to the server instance

Definition at line 349 of file HttpRequest.d.

References HttpMessage::getBridge(), HttpMessage::getConduit(), and IProviderBridge::getServer().

char [] getRemoteHost  )  [inline]
 

Proxy this request across to the server instance

Definition at line 360 of file HttpRequest.d.

References HttpMessage::getBridge(), HttpMessage::getConduit(), and IProviderBridge::getServer().

char [] getServerScheme  )  [inline]
 

Ask the server instance what protocol it is using

Definition at line 371 of file HttpRequest.d.

References HttpMessage::getBridge(), and IProviderBridge::getServer().

Referenced by getRequestUri().

char [] getEncoding  )  [inline]
 

Return the encoding from the input headers.

Reimplemented from HttpMessage.

Definition at line 382 of file HttpRequest.d.

References getMimeType().

char [] getMimeType  )  [inline]
 

Return the mime-type from the input headers.

Reimplemented from HttpMessage.

Definition at line 394 of file HttpRequest.d.

References mimed, and HttpMessage::setMimeAndEncoding().

Referenced by getEncoding().

int getPort  )  [inline]
 

Return the port number this request was sent to.

Definition at line 410 of file HttpRequest.d.

References HttpMessage::getBridge(), getHost(), and IProviderBridge::getServer().

char [] getHost  )  [inline]
 

Get the host name. If we can't get it from the Uri, then we try to extract for the host header. Failing that, we ask the server instance to provide it for us.

Definition at line 430 of file HttpRequest.d.

References Exception, HttpMessage::getBridge(), HttpMessage::getHeader(), Uri::getHost(), Uri::getPort(), getRequestUri(), IProviderBridge::getServer(), host, and Text.

Referenced by getExplicitUri(), and getPort().

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 103 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 143 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 155 of file HttpMessage.d.

References Buffer::getConduit().

Referenced by getRemoteAddr(), and getRemoteHost().

final IBuffer getBuffer  )  [inline, protected, inherited]
 

Return the buffer bound to our conduit

Definition at line 166 of file HttpMessage.d.

final HttpMutableHeaders getHeader  )  [inline, protected, inherited]
 

Return the HttpHeaders wrapper

Definition at line 177 of file HttpMessage.d.

Referenced by HttpResponse::commit(), getHost(), getInputHeaders(), readHeaders(), HttpResponse::sendRedirect(), and this().

final IProviderBridge getBridge  )  [inline, protected, inherited]
 

Return the bridge used by the this message

Definition at line 188 of file HttpMessage.d.

References HttpMessage::bridge.

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

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

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

Definition at line 222 of file HttpMessage.d.

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

Referenced by HttpResponse::sendError().

char [] getContentType  )  [inline, inherited]
 

Return the content-type from the headers.

Definition at line 234 of file HttpMessage.d.

References HttpHeaders::get(), and Text.

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

Parse a text string looking for encoding and mime information

Definition at line 245 of file HttpMessage.d.

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

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


Member Data Documentation

int port [private]
 

Definition at line 74 of file HttpRequest.d.

char [] host [private]
 

Definition at line 75 of file HttpRequest.d.

Referenced by getHost(), and reset().

bool mimed [private]
 

Definition at line 76 of file HttpRequest.d.

Referenced by getMimeType(), and reset().

bool uried [private]
 

Definition at line 76 of file HttpRequest.d.

Referenced by getRequestUri(), and reset().

bool gulped [private]
 

Definition at line 76 of file HttpRequest.d.

Referenced by getInputBuffer(), getInputCookies(), getInputHeaders(), getReader(), and reset().

MutableUri uri [private]
 

Definition at line 81 of file HttpRequest.d.

CompositeToken line [private]
 

Definition at line 82 of file HttpRequest.d.

HttpReader reader [private]
 

Definition at line 83 of file HttpRequest.d.

HttpParams params [private]
 

Definition at line 84 of file HttpRequest.d.

Referenced by getInputParameters(), reset(), and this().

HttpCookies cookies [private]
 

Definition at line 85 of file HttpRequest.d.

StartLine startLine [private]
 

Definition at line 86 of file HttpRequest.d.

Referenced by getInputParameters(), getRequestUri(), getStartLine(), readHeaders(), this(), and write().

InvalidStateException InvalidState [static, private]
 

Definition at line 88 of file HttpRequest.d.

Referenced by getInputCookies(), getInputHeaders(), and this().


The documentation for this class was generated from the following file:
Generated on Sat Apr 9 20:11:39 2005 for Mango by doxygen 1.3.6