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 ServletRequest 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 67 of file HttpRequest.d.


Member Function Documentation

this  )  [inline, static]
 

Setup exceptions and so on

Definition at line 91 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.

Reimplemented in ServletRequest.

Definition at line 105 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.

Reimplemented in ServletRequest.

Definition at line 137 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 157 of file HttpRequest.d.

References startLine.

Uri getRequestUri  )  [inline]
 

Return the request Uri as an immutable version ...

Definition at line 168 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 186 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.

Reimplemented in ServletRequest.

Definition at line 203 of file HttpRequest.d.

References gulped.

HttpCookies getInputCookies  )  [inline]
 

Return the set of parsed request cookies

Definition at line 216 of file HttpRequest.d.

References gulped, and InvalidState.

HttpHeaders getInputHeaders  )  [inline]
 

Return the set of parsed input headers

Definition at line 229 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 243 of file HttpRequest.d.

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

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 287 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 301 of file HttpRequest.d.

References startLine, and IWritable::write().

void readHeaders  )  [inline]
 

Parse all headers from the input.

Definition at line 313 of file HttpRequest.d.

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

Referenced by HttpBridge::cross().

char [] getRemoteAddr  )  [inline]
 

Proxy this request across to the server instance

Definition at line 344 of file HttpRequest.d.

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

char [] getRemoteHost  )  [inline]
 

Proxy this request across to the server instance

Reimplemented in ServletRequest.

Definition at line 355 of file HttpRequest.d.

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

char [] getServerScheme  )  [inline]
 

Ask the server instance what protocol it is using

Definition at line 366 of file HttpRequest.d.

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

Referenced by getRequestUri().

char [] getEncoding  )  [inline]
 

Return the encoding from the input headers.

Reimplemented from HttpMessage.

Definition at line 377 of file HttpRequest.d.

References getMimeType().

char [] getMimeType  )  [inline]
 

Return the mime-type from the input headers.

Reimplemented from HttpMessage.

Definition at line 389 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 405 of file HttpRequest.d.

References HttpMessage::getBridge(), getHost(), IServer::getPort(), 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 425 of file HttpRequest.d.

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

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 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 getRemoteAddr(), and 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 HttpResponse::commit(), getHost(), getInputHeaders(), readHeaders(), HttpResponse::sendRedirect(), ServletResponse::setContentLength(), and 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 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.

Reimplemented in ServletResponse.

Definition at line 219 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.

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 getMimeType(), and HttpMessage::setContentType().


Member Data Documentation

int port [private]
 

Definition at line 69 of file HttpRequest.d.

char [] host [private]
 

Definition at line 70 of file HttpRequest.d.

Referenced by getHost(), and reset().

bool mimed [private]
 

Definition at line 71 of file HttpRequest.d.

Referenced by getMimeType(), and reset().

bool uried [private]
 

Definition at line 71 of file HttpRequest.d.

Referenced by getRequestUri(), and reset().

bool gulped [private]
 

Definition at line 71 of file HttpRequest.d.

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

MutableUri uri [private]
 

Definition at line 76 of file HttpRequest.d.

CompositeToken line [private]
 

Definition at line 77 of file HttpRequest.d.

HttpReader reader [private]
 

Definition at line 78 of file HttpRequest.d.

HttpParams params [private]
 

Definition at line 79 of file HttpRequest.d.

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

HttpCookies cookies [private]
 

Definition at line 80 of file HttpRequest.d.

StartLine startLine [private]
 

Definition at line 81 of file HttpRequest.d.

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

InvalidStateException InvalidState [static, private]
 

Definition at line 83 of file HttpRequest.d.

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


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