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

HttpParams Class Reference

Inheritance diagram for HttpParams:

HttpTokens HttpMutableParams HttpQueryParams List of all members.

Public Types

typedef HttpTokens parse parse

Public Member Functions

 this ()
 this (HttpParams source)
HttpParams clone ()
void parse (IBuffer input)

Static Public Member Functions

static this ()

Private Member Functions

 this (char separator, bool inclusive=false)
 this (HttpTokens source)
void parse (char[] content)
void reset ()
bool isParsed ()
void setParsed (bool parsed)
char[] get (char[] name)
int getInt (char[] name, int ret=-1)
long getDate (char[] name, long date=Rfc1123.InvalidEpoch)
int opApply (int(*dg)(inout HttpToken))
void write (IWriter writer)
bool handleMissingSeparator (char[] s, inout HttpToken element)
private bool split (Token t, inout HttpToken element)
FilteredTokens createFilter (char[] match)
void setOutputBuffer (IBuffer output)
IBuffer getOutputBuffer ()
char[] toOutputString ()
void add (char[] name, void(*dg)(IBuffer))
void add (char[] name, char[] value)
void addInt (char[] name, int value)
void addDate (char[] name, long value)

Private Attributes

TokenStack stack

Static Private Attributes

static BoundToken amp

Detailed Description

Maintains a set of query parameters, parsed from an HTTP request. Use HttpMutableParams instead for output parameters.

Note that these input params may have been encoded by the user- agent. Unfortunately there has been little consensus on what that encoding should be (especially regarding GET query-params). With luck, that will change to a consistent usage of UTF-8 within the near future.

Definition at line 61 of file HttpParams.d.


Member Typedef Documentation

typedef HttpTokens parse parse
 

Definition at line 66 of file HttpParams.d.


Member Function Documentation

static this  )  [inline, static]
 

Setup a token for extracting each query construct

Reimplemented from HttpTokens.

Reimplemented in HttpQueryParams.

Definition at line 74 of file HttpParams.d.

References amp.

this  )  [inline]
 

Construct parameters by telling the TokenStack that name/value pairs are seperated by a '=' character.

Reimplemented from HttpTokens.

Reimplemented in HttpQueryParams.

Definition at line 86 of file HttpParams.d.

this HttpParams  source  )  [inline]
 

Clone a source set of HttpParams

Reimplemented in HttpQueryParams.

Definition at line 97 of file HttpParams.d.

HttpParams clone  )  [inline]
 

Clone this set of HttpParams

Reimplemented in HttpMutableParams.

Definition at line 108 of file HttpParams.d.

References HttpParams.

void parse IBuffer  input  )  [inline]
 

Read all query parameters. Everything is mapped rather than being allocated & copied

Reimplemented from HttpTokens.

Definition at line 120 of file HttpParams.d.

References amp, Token::getLength(), BoundToken::next(), TokenStack::push(), and HttpTokens::setParsed().

this char  separator,
bool  inclusive = false
[inline, inherited]
 

Construct a set of tokens based upon the given delimeter, and an indication of whether said delimeter should be considered part of the left side (effectively the name).

The latter is useful with headers, since the seperating ':' character should really be considered part of the name for purposes of subsequent token matching.

Definition at line 120 of file HttpTokens.d.

References HttpTokens::inclusive, HttpTokens::input, HttpTokens::separator, HttpTokens::sepString, HttpTokens::stack, and TokenStack.

this HttpTokens  source  )  [inline, inherited]
 

Clone a source set of HttpTokens

Definition at line 140 of file HttpTokens.d.

References TokenStack::clone(), HttpTokens::inclusive, HttpTokens::input, HttpTokens::output, HttpTokens::parsed, HttpTokens::separator, HttpTokens::sepString, and HttpTokens::stack.

void parse char[]  content  )  [inline, inherited]
 

Parse an input string.

Definition at line 166 of file HttpTokens.d.

References HttpTokens::input, HttpTokens::parse(), and IBuffer::setValidContent().

void reset  )  [inline, inherited]
 

Reset this set of tokens.

Definition at line 178 of file HttpTokens.d.

References IBuffer::clear(), HttpTokens::output, HttpTokens::parsed, TokenStack::reset(), and HttpTokens::stack.

Referenced by HttpClient::reset().

bool isParsed  )  [inline, inherited]
 

Have tokens been parsed yet?

Definition at line 194 of file HttpTokens.d.

References HttpTokens::parsed.

void setParsed bool  parsed  )  [inline, inherited]
 

Indicate whether tokens have been parsed or not.

Definition at line 205 of file HttpTokens.d.

Referenced by parse(), and HttpHeaders::parse().

char [] get char[]  name  )  [inline, inherited]
 

Return the value of the provided header, or null if the header does not exist

Definition at line 217 of file HttpTokens.d.

References TokenStack::findToken(), HttpTokens::split(), HttpTokens::stack, and HttpToken::value.

Referenced by AdminServlet::addLogger(), HttpTokens::getDate(), HttpTokens::getInt(), AdminServlet::service(), and AdminServlet::setLoggerLevel().

int getInt char[]  name,
int  ret = -1
[inline, inherited]
 

Return the integer value of the provided header, or the provided default-vaule if the header does not exist

Definition at line 237 of file HttpTokens.d.

References HttpTokens::get().

Referenced by AdminServlet::addLogger().

long getDate char[]  name,
long  date = Rfc1123.InvalidEpoch
[inline, inherited]
 

Return the date value of the provided header, or the provided default-value if the header does not exist

Definition at line 254 of file HttpTokens.d.

References HttpTokens::get().

int opApply int(*)(inout HttpToken dg  )  [inline, inherited]
 

Iterate over the set of tokens

Definition at line 270 of file HttpTokens.d.

References HttpTokens::split(), and HttpTokens::stack.

void write IWriter  writer  )  [inline, inherited]
 

Output the token list to the provided writer

Reimplemented from IWritable.

Definition at line 291 of file HttpTokens.d.

References IWriter::cr(), IWriter::put(), and HttpTokens::stack.

bool handleMissingSeparator char[]  s,
inout HttpToken  element
[inline, protected, inherited]
 

overridable method to handle the case where a token does not have a separator. Apparently, this can happen in HTTP usage

Reimplemented in HttpQueryParams.

Definition at line 309 of file HttpTokens.d.

Referenced by HttpTokens::split().

private bool split Token  t,
inout HttpToken  element
[inline, inherited]
 

split basic token into an HttpToken

Definition at line 320 of file HttpTokens.d.

References HttpTokens::emptyString, HttpTokens::handleMissingSeparator(), HttpTokens::inclusive, HttpTokens::separator, and Token::toString().

Referenced by HttpTokens::get(), HttpTokens::FilteredTokens::opApply(), and HttpTokens::opApply().

FilteredTokens createFilter char[]  match  )  [inline, inherited]
 

Create a filter for iterating over the tokens matching a particular name.

Definition at line 350 of file HttpTokens.d.

void setOutputBuffer IBuffer  output  )  [inline, protected, inherited]
 

Set the output buffer for adding tokens to. This is used by the various MutableXXXX classes.

Definition at line 419 of file HttpTokens.d.

References HttpTokens::output.

IBuffer getOutputBuffer  )  [inline, protected, inherited]
 

Return the buffer used for output.

Reimplemented in HttpMutableHeaders.

Definition at line 430 of file HttpTokens.d.

References HttpTokens::output.

char [] toOutputString  )  [inline, inherited]
 

Return a char[] representing the output. An empty array is returned if output was not configured.

Definition at line 442 of file HttpTokens.d.

References HttpTokens::output, and IBuffer::toString().

void add char[]  name,
void(*)(IBuffer dg
[inline, protected, inherited]
 

Add a token with the given name. The content is provided via the specified delegate. We stuff this name & content into the output buffer, and map a new Token onto the appropriate buffer slice.

Definition at line 460 of file HttpTokens.d.

References IBuffer::append(), IBuffer::getLimit(), HttpTokens::inclusive, HttpTokens::output, TokenStack::push(), HttpTokens::sepString, HttpTokens::stack, and IBuffer::toString().

Referenced by HttpTokens::add(), HttpTokens::addDate(), and HttpTokens::addInt().

void add char[]  name,
char[]  value
[inline, protected, inherited]
 

Add a simple name/value pair to the output

Reimplemented in HttpMutableParams.

Definition at line 486 of file HttpTokens.d.

References HttpTokens::add(), and IBuffer::append().

void addInt char[]  name,
int  value
[inline, protected, inherited]
 

Add a name/integer pair to the output

Reimplemented in HttpMutableParams.

Definition at line 502 of file HttpTokens.d.

References HttpTokens::add().

void addDate char[]  name,
long  value
[inline, protected, inherited]
 

Add a name/date(long) pair to the output

Reimplemented in HttpMutableParams.

Definition at line 516 of file HttpTokens.d.

References HttpTokens::add().


Member Data Documentation

BoundToken amp [static, private]
 

Definition at line 63 of file HttpParams.d.

Referenced by parse(), and this().

TokenStack stack [protected, inherited]
 

Definition at line 87 of file HttpTokens.d.

Referenced by HttpTokens::add(), HttpTokens::get(), HttpTokens::FilteredTokens::opApply(), HttpTokens::opApply(), HttpTokens::reset(), HttpTokens::this(), and HttpTokens::write().


The documentation for this class was generated from the following file:
Generated on Mon Nov 14 10:59:54 2005 for Mango by  doxygen 1.4.0