Package org.forgerock.json.resource.http
Class HttpContext
- java.lang.Object
- 
- org.forgerock.services.context.AbstractContext
- 
- org.forgerock.json.resource.http.HttpContext
 
 
- 
- All Implemented Interfaces:
- Context
 
 public final class HttpContext extends AbstractContext AContextcontaining information relating to the originating HTTP request.
- 
- 
Field SummaryFields Modifier and Type Field Description static StringATTR_HEADERSAttribute in the serialized JSON form that holds the request headers.static StringATTR_METHODAttribute in the serialised JSON form that holds the HTTP method of the request.static StringATTR_PARAMETERSAttribute in the serialized JSON form that holds the query and/or form parameters.static StringATTR_PATHAttribute in the serialised JSON form that holds the full URI of the request, excluding anything beyond the path component (i.e., no query parameters).- 
Fields inherited from class org.forgerock.services.context.AbstractContextdata
 
- 
 - 
Constructor SummaryConstructors Constructor Description HttpContext(JsonValue savedContext, ClassLoader classLoader)Restore from JSON representation.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>getHeader(String name)Returns an unmodifiable list containing the values of the named HTTP request header.StringgetHeaderAsString(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.StringgetMethod()Returns the effective HTTP method, taking into account presence of theX-HTTP-Method-Overrideheader.List<String>getParameter(String name)Returns an unmodifiable list containing the values of the named HTTP request parameter.StringgetParameterAsString(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.StringgetPath()Returns the HTTP request path.- 
Methods inherited from class org.forgerock.services.context.AbstractContextas, asContext, containsContext, containsContext, get, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
 
- 
 
- 
- 
- 
Field Detail- 
ATTR_HEADERSpublic static final String ATTR_HEADERS Attribute in the serialized JSON form that holds the request headers.
 - 
ATTR_PARAMETERSpublic static final String ATTR_PARAMETERS Attribute in the serialized JSON form that holds the query and/or form parameters.
 - 
ATTR_METHODpublic static final String ATTR_METHOD Attribute in the serialised JSON form that holds the HTTP method of the request.
 - 
ATTR_PATHpublic static final 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).
 
- 
 - 
Constructor Detail- 
HttpContextpublic HttpContext(JsonValue savedContext, ClassLoader classLoader) Restore from JSON representation.- Parameters:
- savedContext- The JSON representation from which this context's attributes should be parsed. Must be a JSON Object that contains- ATTR_HEADERSand- ATTR_PARAMETERSattributes.
- classLoader- The ClassLoader which can properly resolve the persisted class-name.
 
 
- 
 - 
Method Detail- 
getHeaderpublic List<String> getHeader(String name) Returns an unmodifiable list containing the values of the named HTTP request header.- Parameters:
- name- The name of the HTTP request header.
- Returns:
- An unmodifiable list containing the values of the named HTTP request header, which may be empty if the header is not present in the request.
 
 - 
getHeaderAsStringpublic String getHeaderAsString(String name) Returns the first value of the named HTTP request header.- Parameters:
- name- The name of the HTTP request header.
- Returns:
- The first value of the named HTTP request header, or nullif the header is not present in the request.
 
 - 
getHeaderspublic Map<String,List<String>> getHeaders() Returns an unmodifiable map of the HTTP request headers.- Returns:
- An unmodifiable map of the HTTP request headers.
 
 - 
getMethodpublic String getMethod() Returns the effective HTTP method, taking into account presence of theX-HTTP-Method-Overrideheader.- Returns:
- The effective HTTP method, taking into account presence of the
         X-HTTP-Method-Overrideheader.
 
 - 
getParameterpublic List<String> getParameter(String name) Returns an unmodifiable list containing the values of the named HTTP request parameter.- Parameters:
- name- The name of the HTTP request parameter.
- Returns:
- An unmodifiable list containing the values of the named HTTP request parameter, which may be empty if the parameter is not present in the request.
 
 - 
getParameterAsStringpublic String getParameterAsString(String name) Returns the first value of the named HTTP request parameter.- Parameters:
- name- The name of the HTTP request parameter.
- Returns:
- The first value of the named HTTP request parameter, or
         nullif the parameter is not present in the request.
 
 - 
getParameterspublic Map<String,List<String>> getParameters() Returns an unmodifiable map of the HTTP request parameters.- Returns:
- An unmodifiable map of the HTTP request parameters.
 
 - 
getPathpublic String getPath() Returns the HTTP request path.- Returns:
- The HTTP request path.
 
 
- 
 
-