Fantom

 

abstract class

web::WebReq

sys::Obj
  web::WebReq

WebReq encapsulates a web request.

See pod doc.

Slots

absUriSource

virtual Uri absUri()

The absolute request URI including the full authority and the query string. Also see uri, modBase, and modRel. This method is equivalent to:

"http://" + headers["Host"] + uri

Examples:

http://www.foo.com/a/b/c
http://www.foo.com/a?q=bar
cookiesSource

virtual Str:Str cookies()

Map of cookie values keyed by cookie name. The cookies map is readonly and case insensitive.

formSource

virtual [Str:Str]? form()

Get the key/value pairs of the form data. If the request content type is "application/x-www-form-urlencoded", then the first time this method is called the request content is read and parsed using sys::Uri.decodeQuery. If the content type is not "application/x-www-form-urlencoded" this method returns null.

headersSource

abstract Str:Str headers()

Map of HTTP request headers. The headers map is readonly and case sensitive (see sys::Map.caseInsensitive).

Examples:

req.headers["Accept-Language"]
inSource

abstract InStream in()

The InStream for this request.

methodSource

abstract Str method()

The HTTP request method in uppercase. Example: GET, POST, PUT.

modSource

abstract WebMod mod

Get the WebMod which is currently responsible for processing this request.

modBaseSource

Uri modBase := `/`

Base URI of the current WebMod. This Uri always ends in a slash. This is the URI used to route to the WebMod itself. The remainder of uri is stored in modRel so that the following always holds true (with exception of a trailing slash):

modBase + modRel == uri

For example if the current WebMod is mounted as /mod then:

uri          modBase   modRel
----------   -------   -------
`/mod`       `/mod/`   ``
`/mod/`      `/mod/`   ``
`/mod?q`     `/mod/`   `?q`
`/mod/a`     `/mod/`   `a`
`/mod/a/b`   `/mod/`   `a/b`
modRelSource

Uri modRel()

WebMod relative part of the URI - see modBase.

remoteAddrSource

abstract IpAddr remoteAddr()

Get the IP host address of the client socket making this request.

remotePortSource

abstract Int remotePort()

Get the IP port of the client socket making this request.

sessionSource

abstract WebSession session()

Get the session associated with this browser "connection". The session must be accessed the first time before the response is committed.

stashSource

Str:Obj? stash := ...

Stash allows you to stash objects on the WebReq object in order to pass data b/w Weblets while processing this request.

uriSource

abstract Uri uri()

The request URI including the query string relative to this authority. Also see absUri, modBase, and modRel.

Examples:

/a/b/c
/a?q=bar
versionSource

abstract Version version()

The HTTP version of the request.