HTTP Request

The following object is passed along with every HTTP request. The object is similar to many traditional request objects, except for two special properties: mode and branch. These properties are specific to the XP Portal, automatically indicating the contextual branch and rendering mode.

The request object represents the HTTP request and current context for the controller.

{
  "method": "GET",
  "scheme": "http",
  "host": "enonic.com",
  "port": "80",
  "path": "/my/page",
  "url": "http://enonic.com/my/page?debug=true",
  "remoteAddress": "10.0.0.1",
  "mode": "edit",
  "branch": "master",
  "params": {
    "debug": "true"
  },
  "headers": {
    "Language": "en",
    "Cookies": "mycookie=123; other=abc;"
  },
  "cookies": {
    "mycookie": "123",
    "other": "abc"
  }
}
method
HTTP method of the request.
scheme
Name of the scheme used to make this request (“http” / “https”).
host
Host name of the server to which the request was sent.
port
Port of the server to which the request was sent.
path
Path of the request.
url
URL of the request.
remoteAddress
IP address of the client that sent the request. If the X-Forwarded-For header is set, its value will override the client IP.
mode
Portal rendering mode, one of: edit, preview, live.
branch
Name of the repository branch, one of: draft, master.
body
Optional text value
params
Name/value pairs with the query/form parameters from the request.
headers
Name/value pairs with the HTTP request headers.
cookies
Name/value pairs with the HTTP request cookies.