com.bea.p13n.http
Class Request

java.lang.Object
  extended by com.bea.p13n.http.HttpConfigurableEntity
      extended by com.bea.p13n.http.Request
All Implemented Interfaces
ConfigurableEntity, Serializable

public class Request
extends HttpConfigurableEntity
implements 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 AttributeLoaders specified by the AttributeLoaderBean'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 boolean ATTRIBUTE_OVERRIDE
          Controls whether the getProperty and getPropertyNoDefault methods check the HttpRequest attributes prior to the HttpRequest parameters.
static String AUTHORIZATION_SCHEME
           
static String CHAR_ENCODING
           
static String CONTENT_LENGTH
           
static String CONTENT_TYPE
           
static String CONTEXT_PATH
           
static String LOCAL_ADDR
           
static String LOCAL_NAME
           
static String LOCAL_PORT
           
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_PORT
           
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
           
static String USER_PRINCIPAL
           
 
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)
           
 String getLocalAddr()
           
 Locale getLocale()
           
 Enumeration getLocales()
           
 String getLocalName()
           
 int getLocalPort()
           
 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()
           
 int getRemotePort()
           
 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.
 void setPrincipal(HttpServletRequest 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

REQUEST_PROPERTY_SET_TYPE

public static final String REQUEST_PROPERTY_SET_TYPE
request property set type

See Also
Constants Summary

ATTRIBUTE_OVERRIDE

public static boolean ATTRIBUTE_OVERRIDE
Controls whether the getProperty and getPropertyNoDefault methods check the HttpRequest attributes prior to the HttpRequest parameters. By default, the parameters are checked first. To override the default set the system property com.bea.p13n.http.Request.AttributeOverride=Yes


REQUEST_METHOD

public static final String REQUEST_METHOD
See Also
Constants Summary

REQUEST_URI

public static final String REQUEST_URI
See Also
Constants Summary

REQUEST_URL

public static final String REQUEST_URL
See Also
Constants Summary

REQUEST_PROTOCOL

public static final String REQUEST_PROTOCOL
See Also
Constants Summary

SERVLET_PATH

public static final String SERVLET_PATH
See Also
Constants Summary

PATH_INFO

public static final String PATH_INFO
See Also
Constants Summary

PATH_TRANSLATED

public static final String PATH_TRANSLATED
See Also
Constants Summary

CONTEXT_PATH

public static final String CONTEXT_PATH
See Also
Constants Summary

QUERY_STRING

public static final String QUERY_STRING
See Also
Constants Summary

CONTENT_LENGTH

public static final String CONTENT_LENGTH
See Also
Constants Summary

CONTENT_TYPE

public static final String CONTENT_TYPE
See Also
Constants Summary

SERVER_NAME

public static final String SERVER_NAME
See Also
Constants Summary

SERVER_PORT

public static final String SERVER_PORT
See Also
Constants Summary

REMOTE_USER

public static final String REMOTE_USER
See Also
Constants Summary

REMOTE_ADDRESS

public static final String REMOTE_ADDRESS
See Also
Constants Summary

REMOTE_HOST

public static final String REMOTE_HOST
See Also
Constants Summary

REMOTE_PORT

public static final String REMOTE_PORT
See Also
Constants Summary

LOCAL_NAME

public static final String LOCAL_NAME
See Also
Constants Summary

LOCAL_ADDR

public static final String LOCAL_ADDR
See Also
Constants Summary

LOCAL_PORT

public static final String LOCAL_PORT
See Also
Constants Summary

SCHEME

public static final String SCHEME
See Also
Constants Summary

AUTHORIZATION_SCHEME

public static final String AUTHORIZATION_SCHEME
See Also
Constants Summary

LOCALE

public static final String LOCALE
See Also
Constants Summary

CHAR_ENCODING

public static final String CHAR_ENCODING
See Also
Constants Summary

USER_PRINCIPAL

public static final String USER_PRINCIPAL
See Also
Constants Summary
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.

Parameters
request - the HttpServletRequest used to set and retrieve properties.

Request

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

Parameters
request - the HttpServletRequest used to set and retrieve properties.
createSession - true to also create a Session from the request's session and set it on this.
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.

setP13NSession

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


getP13NSession

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


setPrincipal

public void setPrincipal(HttpServletRequest request)

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

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)

getMethod

public String getMethod(String name)

getAttribute

public Object getAttribute(String name)

getAttributeNames

public Enumeration getAttributeNames()

getCharacterEncoding

public String getCharacterEncoding()

getContentLength

public int getContentLength()

getContentType

public String getContentType()

getInputStream

public ServletInputStream getInputStream()

getParameter

public String getParameter(String name)

getParameterNames

public Enumeration getParameterNames()

getParameterValues

public String[] getParameterValues(String name)

getProtocol

public String getProtocol()

getScheme

public String getScheme()

getServerName

public String getServerName()

getServerPort

public int getServerPort()

getReader

public BufferedReader getReader()

getRemoteAddr

public String getRemoteAddr()

getRemoteHost

public String getRemoteHost()

getRemotePort

public int getRemotePort()

getLocalName

public String getLocalName()

getLocalAddr

public String getLocalAddr()

getLocalPort

public int getLocalPort()

setAttribute

public void setAttribute(String name,
                         Object o)

removeAttribute

public void removeAttribute(String name)

getLocale

public Locale getLocale()

getLocales

public Enumeration getLocales()

isSecure

public boolean isSecure()

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String uri)

getRealPath

public String getRealPath(String path)

getAuthType

public String getAuthType()

getCookies

public Cookie[] getCookies()

getDateHeader

public long getDateHeader(String name)

getHeader

public String getHeader(String name)

getHeaders

public Enumeration getHeaders(String name)

getHeaderNames

public Enumeration getHeaderNames()

getIntHeader

public int getIntHeader(String name)

getMethod

public String getMethod()

getPathInfo

public String getPathInfo()

getPathTranslated

public String getPathTranslated()

getContextPath

public String getContextPath()

getQueryString

public String getQueryString()

getRemoteUser

public String getRemoteUser()

isUserInRole

public boolean isUserInRole(String role)

getUserPrincipal

public Principal getUserPrincipal()

getRequestedSessionId

public String getRequestedSessionId()

getRequestURI

public String getRequestURI()

getServletPath

public String getServletPath()

getSession

public HttpSession getSession(boolean create)

getSession

public HttpSession getSession()

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()

getParameterMap

public Map getParameterMap()

setCharacterEncoding

public void setCharacterEncoding(String anEncoding)

getRequestURL

public StringBuffer getRequestURL()


Copyright © 2006 BEA Systems, Inc. All Rights Reserved