const mixinafBedSheet::HttpRequest
afBedSheet::HttpRequest
(Service) - An injectable const version of WebReq.
This class will always refer to the current web request.
- body
abstract HttpRequestBody body()Returns the request body.
- headers
abstract HttpRequestHeaders headers()Map of HTTP request headers. The map is readonly and case insensitive.
@see web::WebReq.headers
@see http://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Requests
- httpMethod
abstract Str httpMethod()The HTTP request method in uppercase. Example: GET, POST, PUT.
@see web::WebReq.method
- httpVersion
abstract Version httpVersion()The HTTP version of the request.
@see web::WebReq.version
- isXmlHttpRequest
abstract Bool isXmlHttpRequest()Returns
trueif anXMLHttpRequest, as specified by theX-Requested-WithHTTP header.- locales
abstract Locale[] locales()The accepted locales for this request based on the "Accept-Language" HTTP header. List is sorted by preference, where
locales.firstis best, andlocales.lastis worst. This list is guaranteed to contain Locale("en").@see web::WebReq.locales
- parseMultiPartForm
abstract Void parseMultiPartForm(|Str,InStream,Str:Str callback)This method will:
- check that the content-type is form-data
- get the boundary string
- invoke the callback for each part (see web::WebUtil.parseMultiPart)
For each part in the stream this calls the given callback function with the part's form name, headers, and an input stream used to read the part's body.
- remoteAddr
abstract IpAddr remoteAddr()The IP host address of the client socket making this request.
- remotePort
abstract Int remotePort()The IP port of the client socket making this request.
- socketOptions
abstract SocketOptions socketOptions()- stash
Stashallows you to store temporary data on the request, to easily pass it between services and objects.It is good for a quick win, but if you find yourself consistently relying on it, consider making a thread scoped service instead.
- url
abstract Uri url()The URL relative to BedSheetWebMod, includes query string and fragment. Always starts with a
/.Examples:
/a/b/index.html /a?q=bar
This is equivalent to a local URL.
@see web::WebReq.modRel
- urlAbs
abstract Uri urlAbs()The absolute request URL including the full authority and the query string. This method is equivalent to:
"http://" + headers["Host"] + path + url
where
pathis the request path to the currentWebMod.Examples:
http://www.foo.com/a/b/index.html http://www.foo.com/a?q=bar
@see web::WebReq.absUri