© 2005 BEA Systems, Inc.

com.bea.p13n.http
Class Request

java.lang.Object
  extended bycom.bea.p13n.http.HttpConfigurableEntity
      extended bycom.bea.p13n.http.Request
All Implemented Interfaces:
ConfigurableEntity, HttpServletRequest, Serializable, ServletRequest

public class Request
extends HttpConfigurableEntity
implements Serializable, HttpServletRequest

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 AttributeLoaders specified by the AttributeLoaderMBean's RequestLoaders attribute.

See Also:
Serialized Form

Nested Class Summary
static interface Request.AttributeLoader
          An object which is capable of loading additional attributes into a Request.
 
Field Summary
static String AUTHORIZATION_SCHEME
           
static String CHAR_ENCODING
           
static String CONTENT_LENGTH
           
static String CONTENT_TYPE
           
static String CONTEXT_PATH
           
static String LOCALE
           
static String PATH_INFO
           
static String PATH_TRANSLATED
           
static String QUERY_STRING
           
static String REMOTE_ADDRESS
           
static String REMOTE_HOST
           
static String REMOTE_USER
           
static String REQUEST_METHOD
           
static String REQUEST_PROPERTY_SET_TYPE
          request property set type
static String REQUEST_PROTOCOL
           
static String REQUEST_URI
           
static String REQUEST_URL
           
static String SCHEME
           
static String SERVER_NAME
           
static String SERVER_PORT
           
static String SERVLET_PATH
           
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Fields inherited from interface com.bea.p13n.property.ConfigurableEntity
RESERVED_PROPERTY_SET
 
Constructor Summary
Request()
          Default Constructor
Request(HttpServletRequest request)
          Creates a P13N HTTP Request.
Request(HttpServletRequest request, boolean createSession)
          Creates a P13N HTTP Request and, possibly, Session.
 
Method Summary
static Request createP13NRequest(HttpServletRequest request)
          Returns a P13N Request that acts as a surrogate for an HTTP request.
 Object getAttribute(String name)
           
 Enumeration getAttributeNames()
           
 String getAuthType()
           
 String getCharacterEncoding()
           
 int getContentLength()
           
 String getContentType()
           
 String getContextPath()
           
 Cookie[] getCookies()
           
 long getDateHeader(String name)
           
 String getHeader(String name)
           
 Enumeration getHeaderNames()
           
 Enumeration getHeaders(String name)
           
 ServletInputStream getInputStream()
           
 int getIntHeader(String name)
           
 Locale getLocale()
           
 Enumeration getLocales()
           
 String getMethod()
           
 String getMethod(String name)
           
 Session getP13NSession()
          Get the P13N Session related to this request (can be null).
 String getParameter(String name)
           
 Map getParameterMap()
           
 Enumeration getParameterNames()
           
 String[] getParameterValues(String name)
           
 String getPathInfo()
           
 String getPathTranslated()
           
 Object getProperty(String propertySet, String propertyName)
          Retrieves a property value for the specified property set and name.
 Object getPropertyNoDefault(String propertySet, String propertyName)
          Retrieves a property value for the specified property set and name.
 String getProtocol()
           
 String getQueryString()
           
 BufferedReader getReader()
           
 String getRealPath(String path)
           
 String getRemoteAddr()
           
 String getRemoteHost()
           
 String getRemoteUser()
           
 RequestDispatcher getRequestDispatcher(String uri)
           
 String getRequestedSessionId()
           
 String getRequestURI()
           
 StringBuffer getRequestURL()
           
 String getScheme()
           
 String getServerName()
           
 int getServerPort()
           
 String getServletPath()
           
 HttpSession getSession()
           
 HttpSession getSession(boolean create)
           
 Principal getUserPrincipal()
           
 boolean isRequestedSessionIdFromCookie()
           
 boolean isRequestedSessionIdFromUrl()
           
 boolean isRequestedSessionIdFromURL()
           
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
 boolean isUserInRole(String role)
           
 void removeAttribute(String name)
           
 void setAttribute(String name, Object o)
           
 void setCharacterEncoding(String anEncoding)
           
 void setP13NSession(Session session)
          Set the P13N Session related to this request.
 
Methods inherited from class com.bea.p13n.http.HttpConfigurableEntity
getJndiName, getPkString, getProperty, getPropertyAsString, getPropertyDefault, getPropertySetManager, getUniqueId, removeProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTHORIZATION_SCHEME

public static final String AUTHORIZATION_SCHEME
See Also:
Constant Field Values

CHAR_ENCODING

public static final String CHAR_ENCODING
See Also:
Constant Field Values

CONTENT_LENGTH

public static final String CONTENT_LENGTH
See Also:
Constant Field Values

CONTENT_TYPE

public static final String CONTENT_TYPE
See Also:
Constant Field Values

CONTEXT_PATH

public static final String CONTEXT_PATH
See Also:
Constant Field Values

LOCALE

public static final String LOCALE
See Also:
Constant Field Values

PATH_INFO

public static final String PATH_INFO
See Also:
Constant Field Values

PATH_TRANSLATED

public static final String PATH_TRANSLATED
See Also:
Constant Field Values

QUERY_STRING

public static final String QUERY_STRING
See Also:
Constant Field Values

REMOTE_ADDRESS

public static final String REMOTE_ADDRESS
See Also:
Constant Field Values

REMOTE_HOST

public static final String REMOTE_HOST
See Also:
Constant Field Values

REMOTE_USER

public static final String REMOTE_USER
See Also:
Constant Field Values

REQUEST_METHOD

public static final String REQUEST_METHOD
See Also:
Constant Field Values

REQUEST_PROPERTY_SET_TYPE

public static final String REQUEST_PROPERTY_SET_TYPE
request property set type

See Also:
Constant Field Values

REQUEST_PROTOCOL

public static final String REQUEST_PROTOCOL
See Also:
Constant Field Values

REQUEST_URI

public static final String REQUEST_URI
See Also:
Constant Field Values

REQUEST_URL

public static final String REQUEST_URL
See Also:
Constant Field Values

SCHEME

public static final String SCHEME
See Also:
Constant Field Values

SERVER_NAME

public static final String SERVER_NAME
See Also:
Constant Field Values

SERVER_PORT

public static final String SERVER_PORT
See Also:
Constant Field Values

SERVLET_PATH

public static final String SERVLET_PATH
See Also:
Constant Field Values
Constructor Detail

Request

public Request()
Default Constructor


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.


Request

public Request(HttpServletRequest request,
               boolean createSession)
Creates a P13N HTTP Request and, possibly, Session. This object copies values from the supplied HttpServletRequest.

See Also:
setP13NSession(com.bea.p13n.http.Session), Session
Method Detail

createP13NRequest

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
Throws:
IllegalArgumentException - If the paramater is null.

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface ServletRequest

getAttributeNames

public Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface ServletRequest

getAuthType

public String getAuthType()
Specified by:
getAuthType in interface HttpServletRequest

getCharacterEncoding

public String getCharacterEncoding()
Specified by:
getCharacterEncoding in interface ServletRequest

getContentLength

public int getContentLength()
Specified by:
getContentLength in interface ServletRequest

getContentType

public String getContentType()
Specified by:
getContentType in interface ServletRequest

getContextPath

public String getContextPath()
Specified by:
getContextPath in interface HttpServletRequest

getCookies

public Cookie[] getCookies()
Specified by:
getCookies in interface HttpServletRequest

getDateHeader

public long getDateHeader(String name)
Specified by:
getDateHeader in interface HttpServletRequest

getHeader

public String getHeader(String name)
Specified by:
getHeader in interface HttpServletRequest

getHeaderNames

public Enumeration getHeaderNames()
Specified by:
getHeaderNames in interface HttpServletRequest

getHeaders

public Enumeration getHeaders(String name)
Specified by:
getHeaders in interface HttpServletRequest

getInputStream

public ServletInputStream getInputStream()
Specified by:
getInputStream in interface ServletRequest

getIntHeader

public int getIntHeader(String name)
Specified by:
getIntHeader in interface HttpServletRequest

getLocale

public Locale getLocale()
Specified by:
getLocale in interface ServletRequest

getLocales

public Enumeration getLocales()
Specified by:
getLocales in interface ServletRequest

getMethod

public String getMethod()
Specified by:
getMethod in interface HttpServletRequest

getMethod

public String getMethod(String name)

getP13NSession

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


getParameter

public String getParameter(String name)
Specified by:
getParameter in interface ServletRequest

getParameterMap

public Map getParameterMap()
Specified by:
getParameterMap in interface ServletRequest

getParameterNames

public Enumeration getParameterNames()
Specified by:
getParameterNames in interface ServletRequest

getParameterValues

public String[] getParameterValues(String name)
Specified by:
getParameterValues in interface ServletRequest

getPathInfo

public String getPathInfo()
Specified by:
getPathInfo in interface HttpServletRequest

getPathTranslated

public String getPathTranslated()
Specified by:
getPathTranslated in interface HttpServletRequest

getProperty

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.

Specified by:
getProperty in interface ConfigurableEntity
Specified by:
getProperty in class HttpConfigurableEntity
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
See Also:
getPropertyNoDefault(java.lang.String, java.lang.String)

getPropertyNoDefault

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()).

Specified by:
getPropertyNoDefault in interface ConfigurableEntity
Specified by:
getPropertyNoDefault in class HttpConfigurableEntity
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

public String getProtocol()
Specified by:
getProtocol in interface ServletRequest

getQueryString

public String getQueryString()
Specified by:
getQueryString in interface HttpServletRequest

getReader

public BufferedReader getReader()
Specified by:
getReader in interface ServletRequest

getRealPath

public String getRealPath(String path)
Specified by:
getRealPath in interface ServletRequest

getRemoteAddr

public String getRemoteAddr()
Specified by:
getRemoteAddr in interface ServletRequest

getRemoteHost

public String getRemoteHost()
Specified by:
getRemoteHost in interface ServletRequest

getRemoteUser

public String getRemoteUser()
Specified by:
getRemoteUser in interface HttpServletRequest

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String uri)
Specified by:
getRequestDispatcher in interface ServletRequest

getRequestedSessionId

public String getRequestedSessionId()
Specified by:
getRequestedSessionId in interface HttpServletRequest

getRequestURI

public String getRequestURI()
Specified by:
getRequestURI in interface HttpServletRequest

getRequestURL

public StringBuffer getRequestURL()
Specified by:
getRequestURL in interface HttpServletRequest

getScheme

public String getScheme()
Specified by:
getScheme in interface ServletRequest

getServerName

public String getServerName()
Specified by:
getServerName in interface ServletRequest

getServerPort

public int getServerPort()
Specified by:
getServerPort in interface ServletRequest

getServletPath

public String getServletPath()
Specified by:
getServletPath in interface HttpServletRequest

getSession

public HttpSession getSession()
Specified by:
getSession in interface HttpServletRequest

getSession

public HttpSession getSession(boolean create)
Specified by:
getSession in interface HttpServletRequest

getUserPrincipal

public Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface HttpServletRequest

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Specified by:
isRequestedSessionIdFromCookie in interface HttpServletRequest

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
Specified by:
isRequestedSessionIdFromUrl in interface HttpServletRequest

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Specified by:
isRequestedSessionIdFromURL in interface HttpServletRequest

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Specified by:
isRequestedSessionIdValid in interface HttpServletRequest

isSecure

public boolean isSecure()
Specified by:
isSecure in interface ServletRequest

isUserInRole

public boolean isUserInRole(String role)
Specified by:
isUserInRole in interface HttpServletRequest

removeAttribute

public void removeAttribute(String name)
Specified by:
removeAttribute in interface ServletRequest

setAttribute

public void setAttribute(String name,
                         Object o)
Specified by:
setAttribute in interface ServletRequest

setCharacterEncoding

public void setCharacterEncoding(String anEncoding)
Specified by:
setCharacterEncoding in interface ServletRequest

setP13NSession

public void setP13NSession(Session session)
Set the P13N Session related to this request.


© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved