public final class HttpContext extends AbstractContext
Context
containing information relating to the originating HTTP request.Modifier and Type | Field and Description |
---|---|
static String |
ATTR_HEADERS
Attribute in the serialized JSON form that holds the request headers.
|
static String |
ATTR_METHOD
Attribute in the serialised JSON form that holds the HTTP method of the request.
|
static String |
ATTR_PARAMETERS
Attribute in the serialized JSON form that holds the query and/or form parameters.
|
static String |
ATTR_PATH
Attribute in the serialised JSON form that holds the full URI of the request, excluding anything beyond the
path component (i.e., no query parameters).
|
data
Constructor and Description |
---|
HttpContext(JsonValue savedContext,
ClassLoader classLoader)
Restore from JSON representation.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
getHeader(String name)
Returns an unmodifiable list containing the values of the named HTTP
request header.
|
String |
getHeaderAsString(String name)
Returns the first value of the named HTTP request header.
|
Map<String,List<String>> |
getHeaders()
Returns an unmodifiable map of the HTTP request headers.
|
String |
getMethod()
Returns the effective HTTP method, taking into account presence of the
X-HTTP-Method-Override header. |
List<String> |
getParameter(String name)
Returns an unmodifiable list containing the values of the named HTTP
request parameter.
|
String |
getParameterAsString(String name)
Returns the first value of the named HTTP request parameter.
|
Map<String,List<String>> |
getParameters()
Returns an unmodifiable map of the HTTP request parameters.
|
String |
getPath()
Returns the HTTP request path.
|
asContext, containsContext, containsContext, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
public static final String ATTR_HEADERS
public static final String ATTR_PARAMETERS
public static final String ATTR_METHOD
public static final String ATTR_PATH
public HttpContext(JsonValue savedContext, ClassLoader classLoader)
savedContext
- The JSON representation from which this context's attributes
should be parsed. Must be a JSON Object that contains ATTR_HEADERS
and
ATTR_PARAMETERS
attributes.classLoader
- The ClassLoader which can properly resolve the persisted class-name.public List<String> getHeader(String name)
name
- The name of the HTTP request header.public String getHeaderAsString(String name)
name
- The name of the HTTP request header.null
if the header is not present in the request.public Map<String,List<String>> getHeaders()
public String getMethod()
X-HTTP-Method-Override
header.X-HTTP-Method-Override
header.public List<String> getParameter(String name)
name
- The name of the HTTP request parameter.public String getParameterAsString(String name)
name
- The name of the HTTP request parameter.null
if the parameter is not present in the request.public Map<String,List<String>> getParameters()
public String getPath()
Copyright 2011-2017 ForgeRock AS.