# com.bea.p13n.http
Request Class

public class Request
extends `HttpConfigurableEntity`
implements `HttpServletRequest`, `Serializable`

The Personalization Server implementation of the Http Servlet Request interface.

This object is used by the Personalization Server to get properties on an Http Request in a format understandable to Personalization Core Services such as the RulesService.

This will use a `DefaultRequestFilter``` to filter out attributes. After loading the request attributes, this will additionally call out to any `Request.AttributeLoader``` specified by the AttributeLoaderMBean's RequestLoaders attribute.

Hierarchy
  `Object`
  `HttpConfigurableEntity`
  `Request`

All Implemented Interfaces
  `ConfigurableEntity`, `HttpServletRequest`, `Serializable`, `ServletRequest`

## Nested Class Summary

`public static interface` | `Request.AttributeLoader` An object which is capable of loading additional attributes into a Request.

## Field Summary

`public static final `String`` | `AUTHORIZATION_SCHEME` String
`public static final `String`` | `CHAR_ENCODING` String
`public static final `String`` | `CONTENT_LENGTH` String
`public static final `String`` | `CONTENT_TYPE` String
`public static final `String`` | `CONTEXT_PATH` String
`public static final `String`` | `LOCALE` String
`public static final `String`` | `PATH_INFO` String
`public static final `String`` | `PATH_TRANSLATED` String
`public static final `String`` | `QUERY_STRING` String
`public static final `String`` | `REMOTE_ADDRESS` String
`public static final `String`` | `REMOTE_HOST` String
`public static final `String`` | `REMOTE_USER` String
`public static final `String`` | `REQUEST_METHOD` String
`public static final `String`` | `REQUEST_PROPERTY_SET_TYPE` request property set type
`public static final `String`` | `REQUEST_PROTOCOL` String
`public static final `String`` | `REQUEST_URI` String
`public static final `String`` | `REQUEST_URL` String
`public static final `String`` | `SCHEME` String
`public static final `String`` | `SERVER_NAME` String
`public static final `String`` | `SERVER_PORT` String
`public static final `String`` | `SERVLET_PATH` String

## Constructor Summary

Request() Default Constructor
Request(`HttpServletRequest` request, boolean createSession) Creates a P13N HTTP Request and, possibly, Session.
Request(`HttpServletRequest` request) Creates a P13N HTTP Request.

## Method Summary

`public static `Request`` | `createP13NRequest`(`HttpServletRequest` request) Returns a P13N Request that acts as a surrogate for an HTTP request.
`public `Object`` | `getAttribute`(`String` name)
`public `Enumeration`` | `getAttributeNames`()
`public `String`` | `getAuthType`()
`public `String`` | `getCharacterEncoding`()
`public int` | `getContentLength`()
`public `String`` | `getContentType`()
`public `String`` | `getContextPath`()
`public `Cookie`[]` | `getCookies`()
`public long` | `getDateHeader`(`String` name)
`public `String`` | `getHeader`(`String` name)
`public `Enumeration`` | `getHeaderNames`()
`public `Enumeration`` | `getHeaders`(`String` name)
`public `ServletInputStream`` | `getInputStream`()
`public int` | `getIntHeader`(`String` name)
`public `Locale`` | `getLocale`()
`public `Enumeration`` | `getLocales`()
`public `String`` | `getMethod`(`String` name)
`public `String`` | `getMethod`()
`public `Session`` | `getP13NSession`() Get the P13N Session related to this request (can be null).
`public `String`` | `getParameter`(`String` name)
`public `Map`` | `getParameterMap`()
`public `Enumeration`` | `getParameterNames`()
`public `String`[]` | `getParameterValues`(`String` name)
`public `String`` | `getPathInfo`()
`public `String`` | `getPathTranslated`()
`public `Object`` | `getProperty`(`String` propertySet, `String` propertyName) Retrieves a property value for the specified property set and name.
`public `Object`` | `getPropertyNoDefault`(`String` propertySet, `String` propertyName) Retrieves a property value for the specified property set and name.
`public `String`` | `getProtocol`()
`public `String`` | `getQueryString`()
`public `BufferedReader`` | `getReader`()
`public `String`` | `getRealPath`(`String` path)
`public `String`` | `getRemoteAddr`()
`public `String`` | `getRemoteHost`()
`public `String`` | `getRemoteUser`()
`public `RequestDispatcher`` | `getRequestDispatcher`(`String` uri)
`public `String`` | `getRequestedSessionId`()
`public `String`` | `getRequestURI`()
`public `StringBuffer`` | `getRequestURL`()
`public `String`` | `getScheme`()
`public `String`` | `getServerName`()
`public int` | `getServerPort`()
`public `String`` | `getServletPath`()
`public `HttpSession`` | `getSession`(boolean create)
`public `HttpSession`` | `getSession`()
`public `Principal`` | `getUserPrincipal`()
`public boolean` | `isRequestedSessionIdFromCookie`()
`public boolean` | `isRequestedSessionIdFromUrl`()
`public boolean` | `isRequestedSessionIdFromURL`()
`public boolean` | `isRequestedSessionIdValid`()
`public boolean` | `isSecure`()
`public boolean` | `isUserInRole`(`String` role)
`public void` | `removeAttribute`(`String` name)
`public void` | `setAttribute`(`String` name, `Object` o)
`public void` | `setCharacterEncoding`(`String` anEncoding)
`public void` | `setP13NSession`(`Session` session) Set the P13N Session related to this request.

Methods from `com.bea.p13n.http.`HttpConfigurableEntity``
``getJndiName`, `getPkString`, `getProperty`, `getPropertyAsString`, `getPropertyDefault`, `getPropertySetManager`, `getUniqueId`, `removeProperty`, `setProperty``

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `com.bea.p13n.property.`ConfigurableEntity``
``getJndiName`, `getPkString`, `getProperty`, `getPropertyAsString`, `getPropertyNoDefault`, `getUniqueId`, `removeProperty`, `setProperty``

Methods from interface `javax.servlet.http.`HttpServletRequest``
`getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole`

Methods from interface `javax.servlet.`ServletRequest``
`getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding`

## Field Detail

### AUTHORIZATION_SCHEME

    public static final String AUTHORIZATION_SCHEME

### CHAR_ENCODING

    public static final String CHAR_ENCODING

### CONTENT_LENGTH

    public static final String CONTENT_LENGTH

### CONTENT_TYPE

    public static final String CONTENT_TYPE

### CONTEXT_PATH

    public static final String CONTEXT_PATH

### LOCALE

    public static final String LOCALE

### PATH_INFO

    public static final String PATH_INFO

### PATH_TRANSLATED

    public static final String PATH_TRANSLATED

### QUERY_STRING

    public static final String QUERY_STRING

### REMOTE_ADDRESS

    public static final String REMOTE_ADDRESS

### REMOTE_HOST

    public static final String REMOTE_HOST

### REMOTE_USER

    public static final String REMOTE_USER

### REQUEST_METHOD

    public static final String REQUEST_METHOD

### REQUEST_PROPERTY_SET_TYPE

    public static final String REQUEST_PROPERTY_SET_TYPE

  request property set type

### REQUEST_PROTOCOL

    public static final String REQUEST_PROTOCOL

### REQUEST_URI

    public static final String REQUEST_URI

### REQUEST_URL

    public static final String REQUEST_URL

### SCHEME

    public static final String SCHEME

### SERVER_NAME

    public static final String SERVER_NAME

### SERVER_PORT

    public static final String SERVER_PORT

### SERVLET_PATH

    public static final String SERVLET_PATH

## Constructor Detail

### Request

    public Request()

  Default Constructor

### Request

    public Request(HttpServletRequest request,
                   boolean createSession)

  Creates a P13N HTTP Request and, possibly, Session. This object copies values from the supplied HttpServletRequest.

Related Topics

``Request.setP13NSession(Session)``
``Session``

### Request

    public Request(HttpServletRequest request)

  Creates a P13N HTTP Request. This object copies values from the supplied HttpServletRequest. This does not automatically create the Session.

## Method Detail

### createP13NRequest(HttpServletRequest) Method

    public static Request createP13NRequest(HttpServletRequest request)
         throws IllegalArgumentException

Returns a P13N Request that acts as a surrogate for an HTTP request.

#### Parameters

request
  the request used to create the Session object.

#### Returns

a new ConfigurableEntity that allows access to an `HttpServletRequest`

#### Exceptions

``IllegalArgumentException``
  If the paramater is null.

### getAttribute(String) Method

    public Object getAttribute(String name)

### getAttributeNames() Method

    public Enumeration getAttributeNames()

### getAuthType() Method

    public String getAuthType()

### getCharacterEncoding() Method

    public String getCharacterEncoding()

### getContentLength() Method

    public int getContentLength()

### getContentType() Method

    public String getContentType()

### getContextPath() Method

    public String getContextPath()

### getCookies() Method

    public Cookie[] getCookies()

### getDateHeader(String) Method

    public long getDateHeader(String name)

### getHeader(String) Method

    public String getHeader(String name)

### getHeaderNames() Method

    public Enumeration getHeaderNames()

### getHeaders(String) Method

    public Enumeration getHeaders(String name)

### getInputStream() Method

    public ServletInputStream getInputStream()

### getIntHeader(String) Method

    public int getIntHeader(String name)

### getLocale() Method

    public Locale getLocale()

### getLocales() Method

    public Enumeration getLocales()

### getMethod(String) Method

    public String getMethod(String name)

### getMethod() Method

    public String getMethod()

### getP13NSession() Method

    public Session getP13NSession()

Get the P13N Session related to this request (can be null).

### getParameter(String) Method

    public String getParameter(String name)

### getParameterMap() Method

    public Map getParameterMap()

### getParameterNames() Method

    public Enumeration getParameterNames()

### getParameterValues(String) Method

    public String[] getParameterValues(String name)

### getPathInfo() Method

    public String getPathInfo()

### getPathTranslated() Method

    public String getPathTranslated()

### getProperty(String, String) Method

    public Object getProperty(String propertySet,
                              String propertyName)

Retrieves a property value for the specified property set and name. The getProperty method will first look in the HTTP request attributes for the property and if not found, it will look for the property in the HTTP request parameters. If not found, then it looks in the Http headers. If not found, then it looks in the request methods (getContentType()). If not found, then it uses the propertySet parameter to find a propertySet for a 'REQUEST' type. If found, it uses the default value in that property set.

Overrides
  `HttpConfigurableEntity.getProperty(String, String)`

#### Parameters

propertySet
  The name of the property set for which the property is sought. This only used if no property is found in the request and we use the scope to look up the default value in the property set for the request. This parameter can be null.

propertyName
  The property name

#### Returns

the property value

Related Topics

``Request.getPropertyNoDefault(String, String)``

### getPropertyNoDefault(String, String) Method

    public Object getPropertyNoDefault(String propertySet,
                                       String propertyName)

Retrieves a property value for the specified property set and name. The getProperty method will first look in the HTTP request attributes for the property and if not found, it will look for the property in the HTTP request parameters. If not found, then it looks in the Http headers. If not found, then it looks in the request methods (getContentType()).

Overrides
  `HttpConfigurableEntity.getPropertyNoDefault(String, String)`

#### Parameters

propertySet
  The name of the property set for which the property is sought. This only used if no property is found in the request and we use the scope to look up the default value in the property set for the request. This parameter can be null.

propertyName
  The property name

#### Returns

the property value

### getProtocol() Method

    public String getProtocol()

### getQueryString() Method

    public String getQueryString()

### getReader() Method

    public BufferedReader getReader()

### getRealPath(String) Method

    public String getRealPath(String path)

### getRemoteAddr() Method

    public String getRemoteAddr()

### getRemoteHost() Method

    public String getRemoteHost()

### getRemoteUser() Method

    public String getRemoteUser()

### getRequestDispatcher(String) Method

    public RequestDispatcher getRequestDispatcher(String uri)

### getRequestedSessionId() Method

    public String getRequestedSessionId()

### getRequestURI() Method

    public String getRequestURI()

### getRequestURL() Method

    public StringBuffer getRequestURL()

### getScheme() Method

    public String getScheme()

### getServerName() Method

    public String getServerName()

### getServerPort() Method

    public int getServerPort()

### getServletPath() Method

    public String getServletPath()

### getSession(boolean) Method

    public HttpSession getSession(boolean create)

### getSession() Method

    public HttpSession getSession()

### getUserPrincipal() Method

    public Principal getUserPrincipal()

### isRequestedSessionIdFromCookie() Method

    public boolean isRequestedSessionIdFromCookie()

### isRequestedSessionIdFromUrl() Method

    public boolean isRequestedSessionIdFromUrl()

### isRequestedSessionIdFromURL() Method

    public boolean isRequestedSessionIdFromURL()

### isRequestedSessionIdValid() Method

    public boolean isRequestedSessionIdValid()

### isSecure() Method

    public boolean isSecure()

### isUserInRole(String) Method

    public boolean isUserInRole(String role)

### removeAttribute(String) Method

    public void removeAttribute(String name)

### setAttribute(String, Object) Method

    public void setAttribute(String name,
                             Object o)

### setCharacterEncoding(String) Method

    public void setCharacterEncoding(String anEncoding)

### setP13NSession(Session) Method

    public void setP13NSession(Session session)

Set the P13N Session related to this request.