|
Unite API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--WebServerRequest
Request made to the Web server.
WebServerRequest holds information about the incoming request, such as its URI, method and any data sent along with it.
| Field Summary | |
String |
body
The full body of the HTTP request as a String. |
Object |
bodyItems
The items in the body of this request, meaning data sent as POST. |
WebServerConnection |
connection
The connection this request was sent through. |
File |
files
Files uploaded with this request. |
Object |
headers
The HTTP headers sent with this request. |
String |
host
The value of the Host header sent with this request. |
String |
ip
The IP address of the client that sent this request. |
String |
method
The HTTP method of this request, one of GET, POST, PUT or DELETE. |
String |
protocol
The protocol this request was made to. |
Object |
queryItems
The items sent as part of the query string in this request, meaning data sent as GET. |
String |
uri
The relative Uniform Resource Identifier this request was made to. |
| Constructor Summary | |
WebServerRequest()
This class has no public constructor. |
|
| Method Summary | |
Object
|
getItem( <String> requestItem, <String> method )
Get the value of a request item. |
Object
|
getRequestHeader( <String> requestHeader )
Get the values of a HTTP header in the request. |
| Field Detail |
String body
Object bodyItems
This property will contain a dictionary of only those items sent as part of the body of the request, for example large amounts of text or sensitive information such as passwords that should not be visible in the URL.
As each CGI parameter may occur multiple times, each key/property of the dictionary points to an array-like object of values.
password = request.bodyItems.passwords[0];
password = request.bodyItems['passwords'][0];
passwords = request.bodyItems.passwords
WebServerConnection connection
File files
This File object represents a virtual directory which points to the uploaded files. Access the individual files by getting the listing from the file.
The name of the file is the filename the user selected when uploading.
Request headers for these files are available through the metaData property:
req.files[0].metaData.headers['some header'];
See the File API for details about files.
Object headers
This property will contain a dictionary of HTTP headers sent with this request. As each HTTP header may occur multiple times, each key/property of the dictionary points to an array-like object of values:
firstCookie = request.headers.Cookie[0];
firstCookie = request.headers['Cookie'][0];
String host
String ip
This currently only gives you the IP address of the proxy.
String method
String protocol
Object queryItems
This property will contain a dictionary of only those items sent as part of the query string i.e. anything after the ? in the URL.
As each CGI parameter may occur multiple times, each key/property of the dictionary points to an array-like object of values.
user = request.queryItems.user[0];
user = request.queryItems['user'][0];
users = request.queryItems.users;
String uri
Relative URI the request is made out to, starting with '/' and the name of the service, e.g. http://work.john.operaunite.com/wiki/add becomes '/wiki/add'. It is rewritable to allow redispatching of the request. See the WebServerResponse.closeAndRedispatch() method.
Setting this property will throw a SECURITY_ERR if an invalid URI is set or if the URI points to a different service than the one the request was issued from.
| Constructor Detail |
WebServerRequest()
| Method Detail |
Object getItem( <String> requestItem, <String> method )
This method gets the values of items sent in a query string (typically through GET requests)
or in the body of the request (typically through POST requests). Each item may occur multiple times
with different values, both in the query string and the body. The optional second argument
method can be used to limit the selection to either of those two.
In the case of a query string foo=bar:
getItem( 'foo' ) will produce an array-like object [ 'bar' ].
In the case of a query string foo=bar&foo=baz:
getItem( 'foo' ) will produce an array-like object [ 'bar', 'baz' ].
In the case of a query string foo=bar and a request body containing foo=baz:
getItem( 'foo', 'POST' ) will produce an array-like object [ 'baz' ].
requestItem - Name of the request item to get
method - Optional argument with the method of the request item to get, either GET or POST.
Object getRequestHeader( <String> requestHeader )
The returned object is a collection of headers matching the given header name.
Assuming that the client sent a request with a header of Foo, access it as follows:
headers = request.getRequestHeader('Foo');
if ( headers )
{
opera.postError(headers[0]);
}
requestHeader - Name of the HTTP header to get.
|
Unite API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||