new WebRequest()
Represents the client HTTP request currently being processed.
- See:
-
- $.response represents the corresponding response object.
Example
if($.request.method === $.net.http.GET) {
// get query parameter named id
var qpId = $.request.parameters.get("id");
// handle request for the given id parameter...
var result = handleRequest(qpId);
// send response
$.response.contentType = "plain/test";
$.response.setBody("result: " + result);
$.response.status = $.net.http.OK;
} else {
// unsupported method
$.response.status = $.net.http.INTERNAL_SERVER_ERROR;
}
Extends
Members
-
body :$.web.Body|undefined
-
The body of the request. The value is undefined when there is no body. Only available on $.request.
Type:
- $.web.Body | undefined
- Inherited From:
-
contentType :string
-
The content type of the entity
Type:
- string
- Inherited From:
-
cookies :$.web.TupelList
-
The cookies associated with the entity
Type:
-
entities :$.web.EntityList
-
The sub-entities of the entity
Type:
- Inherited From:
-
headers :$.web.TupelList
-
The headers of the entity
Type:
- Inherited From:
-
<readonly> language :string
-
Language of the request in IETF (BCP 47) format. This property contains the language that is used for the request. Application code should rely on this property only. The value is a string in the format specified by the IETF (BCP 47) standard.
The value of the property is determined by checking the following sources in descending precedence:
- Custom x-sap-request-language HTTP header
- $.application.language
- $.session.language
- Accept-Language HTTP header
Type:
- string
-
method :$.net.http
-
The HTTP method of the incoming HTTP request
Type:
-
parameters :$.web.TupelList
-
The parameters of the entity
Type:
- Inherited From:
-
path :string
-
The URL path specified in the request
Type:
- string
Example
// http://myhost:8000/exampleapp/path/to/requested/resource.xsjs // ^ ^ // | | // ---- request URL path ----
-
queryPath :string
-
The URL query path specified in the request
Type:
- string
Example
// http://myhost:8000/exampleapp/resource.xsjs/some/more/options?param=value // ^ ^ // | | // -- query path --
Methods
-
setBody(body, index)
-
Sets the body of the entity; the method supports all elemental JavaScript types and ArrayBuffers.
Parameters:
Name Type Argument Description body
any | ArrayBuffer Can be any elemental JavaScript type or an ArrayBuffer index
Number <optional>
If the first argument is ResultSet, the number specifies the index of a Blob column - Inherited From:
Throws:
Throws an error if the parameters are invalid