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

Uri Class Reference

Inheritance diagram for Uri:

IWritable MutableUri List of all members.

Public Member Functions

 this (char[] uri)
char[] getScheme ()
char[] getHost ()
int getPort ()
int getValidPort ()
char[] getUserInfo ()
char[] getPath ()
char[] getQuery ()
char[] getFragment ()
bool isGeneric ()
IBuffer write (IBuffer buf)
void write (IWriter writer)
override char[] toString ()
char[] decode (char[] s)

Static Public Member Functions

 this ()
final int getDefaultPort (char[] scheme)

Private Types

enum  {
  ExcScheme = 0x01, ExcAuthority = 0x02, ExcPath = 0x04, ExcQuery = 0x08,
  IncUser = 0x10, IncPath = 0x20, IncQuery = 0x40, IncScheme = 0x80,
  IncGeneric = IncScheme | IncUser | IncPath | IncQuery
}

Private Member Functions

 this ()
void parse (char[] uri)
void parseAuthority (char[] auth)

Static Private Member Functions

IBuffer encode (IBuffer buf, char[] s, int flags)

Private Attributes

const int InvalidPort = -1
int port
char[] host
char[] path
char[] query
char[] scheme
char[] userinfo
char[] fragment
HeapSlice decoded

Static Private Attributes

ubyte map [256]
short[char[]] genericSchemes
const char[] hexDigits = "0123456789abcdef"
IOException error
const SchemePort[] schemePorts

Detailed Description

Implements an RFC 2396 compliant URI specification. See this page for more information.

The implementation fails the spec on two counts: it doesn't insist on a scheme being present in the Uri, and it doesn't implement the "Relative References" support noted in section 5.2

Use the MutableUri derivative where you need to alter specific uri attributes.

Definition at line 69 of file Uri.d.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
ExcScheme 
ExcAuthority 
ExcPath 
ExcQuery 
IncUser 
IncPath 
IncQuery 
IncScheme 
IncGeneric 

Definition at line 578 of file Uri.d.


Member Function Documentation

this  )  [inline, static]
 

Initialize the Uri character maps and so on

Reimplemented in MutableUri.

Definition at line 77 of file Uri.d.

References error, ExcAuthority, ExcPath, ExcQuery, ExcScheme, genericSchemes, IncGeneric, IncPath, IncQuery, IncScheme, IncUser, and schemePorts.

this char[]  uri  )  [inline]
 

Reimplemented in MutableUri.

Definition at line 159 of file Uri.d.

References parse().

final int getDefaultPort char[]  scheme  )  [inline, static]
 

Definition at line 173 of file Uri.d.

References genericSchemes, and InvalidPort.

Referenced by getValidPort().

char [] getScheme  )  [inline]
 

Definition at line 188 of file Uri.d.

References scheme.

Referenced by HttpRequest::getRequestUri(), testFilePath(), and testServletEngine().

char [] getHost  )  [inline]
 

Definition at line 200 of file Uri.d.

Referenced by HttpRequest::getExplicitUri(), HttpRequest::getHost(), testFilePath(), testHttpClient3(), and HttpClient::this().

int getPort  )  [inline]
 

Definition at line 212 of file Uri.d.

Referenced by HttpRequest::getHost(), and testFilePath().

int getValidPort  )  [inline]
 

Definition at line 224 of file Uri.d.

References getDefaultPort(), InvalidPort, and scheme.

Referenced by HttpClient::this().

char [] getUserInfo  )  [inline]
 

Definition at line 238 of file Uri.d.

References userinfo.

char [] getPath  )  [inline]
 

Definition at line 250 of file Uri.d.

Referenced by HttpClient::open(), ServletProvider::service(), testFilePath(), and testServletEngine().

char [] getQuery  )  [inline]
 

Definition at line 262 of file Uri.d.

References query.

Referenced by HttpRequest::getInputParameters(), and testServletEngine().

char [] getFragment  )  [inline]
 

Definition at line 274 of file Uri.d.

References fragment.

bool isGeneric  )  [inline]
 

Definition at line 285 of file Uri.d.

References genericSchemes, and scheme.

IBuffer write IBuffer  buf  )  [inline]
 

Definition at line 297 of file Uri.d.

References IBuffer::append(), encode(), IncUser, InvalidPort, scheme, and userinfo.

void write IWriter  writer  )  [inline]
 

Reimplemented from IWritable.

Definition at line 345 of file Uri.d.

override char [] toString  )  [inline]
 

Definition at line 356 of file Uri.d.

References memchr().

Referenced by AdminServlet::service(), and testFilePath().

char [] decode char[]  s  )  [inline]
 

Definition at line 369 of file Uri.d.

Referenced by HttpRequest::getInputParameters().

IBuffer encode IBuffer  buf,
char[]  s,
int  flags
[inline, static, private]
 

Encode uri characters into an output buffer, such that reserved chars are converted into their hex version.

Definition at line 408 of file Uri.d.

References IBuffer::append(), and IBuffer::put().

Referenced by write().

this  )  [inline, private]
 

This should not be exposed outside of this module!

Reimplemented in MutableUri.

Definition at line 440 of file Uri.d.

void parse char[]  uri  )  [inline, private]
 

Parsing is performed according to RFC 2396

^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? 12 3 4 5 6 7 8 9 2 isolates scheme 4 isolates authority 5 isolates path 7 isolates query 9 isolates fragment

This was originally a state-machine; it turned out to be a lot faster (~40%) when unwound like this instead.

Reimplemented in MutableUri.

Definition at line 466 of file Uri.d.

Referenced by this().

void parseAuthority char[]  auth  )  [inline, private]
 

Authority is the section after the scheme, but before the path, query or fragment; it typically represents a host.

^(([^@]*)@?)([^:]*)?(:(.*))? 12 3 4 5 2 isolates userinfo 3 isolates host 5 isolates port

Definition at line 524 of file Uri.d.


Member Data Documentation

const int InvalidPort = -1 [private]
 

Class attributes

Definition at line 558 of file Uri.d.

Referenced by getDefaultPort(), getValidPort(), and write().

int port [private]
 

Definition at line 560 of file Uri.d.

char [] host [private]
 

Definition at line 561 of file Uri.d.

char [] path [private]
 

Definition at line 561 of file Uri.d.

char [] query [private]
 

Definition at line 561 of file Uri.d.

Referenced by getQuery().

char [] scheme [private]
 

Definition at line 561 of file Uri.d.

Referenced by getScheme(), getValidPort(), isGeneric(), and write().

char [] userinfo [private]
 

Definition at line 561 of file Uri.d.

Referenced by getUserInfo(), and write().

char [] fragment [private]
 

Definition at line 561 of file Uri.d.

Referenced by getFragment().

HeapSlice decoded [private]
 

Definition at line 567 of file Uri.d.

ubyte map[256] [static, private]
 

Definition at line 569 of file Uri.d.

short [char[]] genericSchemes [static, private]
 

Definition at line 572 of file Uri.d.

Referenced by getDefaultPort(), isGeneric(), and this().

const char [] hexDigits = "0123456789abcdef" [static, private]
 

Definition at line 574 of file Uri.d.

IOException error [static, private]
 

Definition at line 576 of file Uri.d.

Referenced by this().

const SchemePort [] schemePorts [static, private]
 

Initial value:

                        [
                        {"coffee",      80}

Definition at line 596 of file Uri.d.

Referenced by this().


The documentation for this class was generated from the following file:
Generated on Sun Oct 24 22:31:32 2004 for Mango by doxygen 1.3.6