getHttpCookies()
:
Cookies
Returns the Cookies object, which can be used to read cookies sent by the client.
getHttpMethod()
:
String
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
getHttpURL()
:
URL
Returns the complete URL of the request which was received at the server.
getTriggeredForm()
:
Form
Returns the form that was submitted by the client if the request represents a form submission.
isHttpRequest()
:
boolean
Identifies if this request is an HTTP request.
isHttpSecure()
:
boolean
Returns whether the HTTP communication is secure, which basically means that the communication happens via https.
isIncludeRequest()
:
boolean
Returns true if the request represents a request for a remote include, false if it is a top-level request.
isSCAPI()
:
boolean
Returns whether the request originated in SCAPI, identified by the presence of the "_sfdc_mercury" header.
setGeolocation(geoLocation
:
Geolocation)
:
void
Sets the physical location for the current request and remembers the new value for the duration of the user session.
setLocale(localeID
:
String)
:
boolean
Sets the given locale for the request.
addHttpCookie
addHttpCookie(cookie
:
Cookie)
:
void
Adds the specified cookie to the outgoing response. This method can be called multiple times to set more than one
cookie. If a cookie with the same cookie name, domain and path is set multiple times for the same response, only
the last set cookie with this name is send to the client. This method can be used to set, update or delete
cookies at the client. If the cookie doesn't exist at the client, it is set initially. If a cookie with the same
name, domain and path already exists at the client, it is updated. A cookie can be deleted at the client by
submitting a cookie with the maxAge attribute set to 0 (see
Cookie.setMaxAge()
for more information).
Example, how a cookie can be deleted at the client:
var cookie : Cookie = new Cookie("SomeName", "Simple Value");
cookie.setMaxAge(0);
request.addHttpCookie(cookie);
Parameters:
cookie
-
a Cookie object
getClientId
Returns the client id of the current SCAPI or OCAPI request. If the request is not a SCAPI request or not an
OCAPI request 'null' is returned. For client ids owned by Commerce Cloud Digital an alias is returned. For SCAPI
requests, the value of the _sfdc_client_id header is returned.
Returns:
a client id or alias in case of an OCAPI request, otherwise null.
getCustom
Returns all of the custom attributes associated with the request. The attributes are stored for the life time of
the request.
Returns:
all of the custom attributes associated with the request.
getGeolocation
Returns the physical location for the current request, if available. The
location is calculated based on the IP address of the request. Note, if
the geolocation tracking feature is not enabled, this method always
returns null.
Returns:
The geolocation of the current request, or null if this is not available.
getHttpCookies
Returns the Cookies object, which can be used to read cookies sent by the client. Use the method
Response.addHttpCookie()
to add a cookie to the outgoing response.
Returns:
Cookies object or null if this is not an HTTP request
getHttpHeaders
Returns a Map containing all HTTP header values.
Returns:
a Map containing all HTTP header values.
getHttpHost
Returns the host name or null if there is no host name.
Returns:
the host name or null if there is no host name.
getHttpLocale
Returns the locale or null if there is no associated locale.
Returns:
the locale or null.
getHttpMethod
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
getHttpParameterMap
Returns the parameter map that contains the HTTP parameters for the current request.
Returns:
the HTTP parameter map
getHttpParameters
getHttpParameters()
:
Map
Returns a Map containing the raw HTTP parameters sent to the server. The Map contains name/value pairs. Each name
is a String and each value is a String array.
Returns:
a Map containing all the raw HTTP parameters send to the server.
getHttpPath
Returns the path.
Returns:
the path or null.
getHttpProtocol
Returns the HTTP protocol used for this request. Possible values are "http" or "https". If the current activity
is not related to an HTTP request, for example, when the request is part of a job, this method returns null.
Returns:
"http", "https" or null
getHttpQueryString
Returns the query string or null if there is no query string.
Returns:
the query string or null.
getHttpReferer
Returns the referer or null if there is no referer.
Returns:
the referer or null if there is no referer.
getHttpRemoteAddress
getHttpRemoteAddress()
:
String
Returns the remote address or null if no remote address is found.
Returns:
the remote address or null if no remote address is found.
getHttpURL
Returns the complete URL of the request which was received at the server.
This URL does not include SEO optimizations.
Returns:
the URL as URL object
getHttpUserAgent
Returns the HTTP user agent or null if there is no user agent.
Returns:
the HTTP user agent or null if there is no user agent.
getLocale
Returns the locale of the current request. This locale is set by the system based on the information in the URL.
It may be different from the locale returned by
getHttpLocale(), which is the preferred locale sent by the user agent.
Returns:
the locale of the current request, like 'en_US'
getOcapiVersion
Returns the OCAPI version of the current request. If this is not
an OCAPI request, 'null' is returned.
Returns:
OCAPI version of the current request
getPageMetaData
Returns the page meta data that are associated with the current request.
Returns:
the page meta data object
getRequestID
Returns the unique identifier of the current request. The unique id is helpful for debugging purpose, e.g. relate
debug messages to a particular request.
Returns:
the unique identifier of the current request.
getSession
Returns the session associated with this request.
Returns:
the session associated with this request.
getTriggeredForm
getTriggeredForm()
:
Form
Returns the form that was submitted by the client if the request represents a form submission.
Returns:
the form which was triggered
getTriggeredFormAction
Returns the form action that was triggered by the client if the request represents a form submission.
Returns:
the action of the form that was triggered
isHttpRequest
isHttpRequest()
:
boolean
Identifies if this request is an HTTP request. The method returns true, if the current processing is related to a
HTTP request. For example during a job execution this flag is false.
Returns:
true if the current processing is related to a HTTP request, false otherwise.
isHttpSecure
isHttpSecure()
:
boolean
Returns whether the HTTP communication is secure, which basically means that the communication happens via https.
If the current activity is not related to an HTTP request the method returns false.
isIncludeRequest
isIncludeRequest()
:
boolean
Returns true if the request represents a request for a remote include, false if it is a top-level request.
isSCAPI
isSCAPI()
:
boolean
Returns whether the request originated in SCAPI, identified by the presence of the "_sfdc_mercury" header.
setGeolocation
Sets the physical location for the current request and remembers the new
value for the duration of the user session. So any subsequent calls to
getGeolocation() will return this value
Parameters:
geoLocation
-
the geolocation object to use
setLocale
setLocale(localeID
:
String)
:
boolean
Sets the given locale for the request. The locale is only set if it is valid, if it is active and if it is
allowed for the current site.
Parameters:
localeID
-
the locale ID to be set, like 'en_US'
Returns:
true, if the locale was successfully set, false otherwise