com.ibm.websphere.personalization
Interface RequestContext

All Superinterfaces:
java.lang.Cloneable, java.io.Serializable
All Known Implementing Classes:
PersonalizationContext

public interface RequestContext
extends java.lang.Cloneable, java.io.Serializable

This is the interface used to access various attributes for rules.

For http contexts, it provides access to the HttpRequest and HttpSession attributes. For non-http contexts, it provides the same interface to a surrogate for the request and session.


Field Summary
static java.lang.String COPYRIGHT
           
 
Method Summary
 boolean addCookie(javax.servlet.http.Cookie cookie)
          Sets a cookie.
 java.lang.Object clone()
           
 java.lang.Object get(java.lang.String key)
          Get a value from the context.
 java.lang.Object getApplicationObject(java.lang.String key, java.lang.String className)
          Get the Application Object of the specified key.
 java.lang.String getAuthenticatedUsername()
          Returns the username of the Authenticated User.
 java.lang.String getContextPath()
          Used to get contextPath name from the HttpContext or surrogate.
 javax.servlet.http.Cookie getCookie(java.lang.String cookieName)
          Returns the value of a particular cookie, or null if none exist.
 javax.servlet.http.Cookie[] getCookies()
          Returns the array of cookies known to the request, or null if none exist.
 java.util.Locale getLocale()
          Used to get locale from the HttpContext or surrogate.
 java.lang.Object getPortletAttribute(java.lang.String itemName)
          Returns the value of the named attribute as an Object, or null if no attribute of the given name exists
 java.lang.Object getPortletSetting(java.lang.String itemName)
          Returns the value of the named setting as an Object, or null if no attribute of the given name exists.
 Resource getPreviewUserResource(java.lang.String resourceCollectionPath)
          Returns the user Resource instance when in preview mode
 PznRequestObjectInterface getPznRequestObjectInterface()
          Returns the PznRequestObjectInterface
 java.lang.String getRemoteHost()
          Returns the hostName (IP address if hostName cannot be determined) of the server requesting the jsp or servlet containing the rule request
 java.lang.String getRemoteUser()
          Used to get remoteUser name from the HttpContext or surrogate.
 java.lang.Object getRequestAttribute(java.lang.String itemName)
          Returns the value of the named attribute as an Object, or null if no attribute of the given name exists
 java.util.Date getRequestDate()
          Returns the date of the request.
 java.lang.String getRequestInfo()
           
 java.lang.String getRequestParameter(java.lang.String itemName)
          Returns the value of a request parameter as a String, or null if the parameter does not exist.
 java.lang.String[] getRequestParameterValues(java.lang.String itemName)
          Returns the value of a request parameter as a String, or null if the parameter does not exist.
 java.lang.String getRequestUsername()
          Returns the username that personalization will use.
 com.ibm.websphere.personalization.resources.ResourceContext getResourceContext()
          Deprecated.  
 java.lang.String getServerName()
          Returns the hostName (IP address if hostName cannot be determined) of the server processing the rule request
 java.lang.Object getSessionAttribute(java.lang.String itemName)
          Returns the value of the named attribute as an Object, or null if no attribute of the given name exists
 java.lang.String getSessionInfo()
           
 java.lang.String getTranslatedUsername(java.lang.String collectionName)
          Returns the username that personalization will use for the specified collection.
 boolean isPreviewMode()
          Returns true if this is a preview execution context
 void removePortletAttribute(java.lang.String itemName)
          Remove the value of the named attribute as an Object
 void removeRequestAttribute(java.lang.String itemName)
          Remove the value of the named attribute as an Object
 void removeSessionAttribute(java.lang.String itemName)
          Remove the value of the named attribute
 boolean setContextPath(java.lang.String contextPath)
          Used to set the application contextPath in the HttpContext surrogate.
 boolean setLocale(java.util.Locale locale)
          Used to set locale in the HttpContext surrogate.
 boolean setPortletAttribute(java.lang.String itemName, java.lang.Object itemValue)
          Set the value of the named attribute as an Object
 boolean setRemoteUser(java.lang.String userName)
          Used to set remoteUser name in the HttpContext surrogate.
 void setRequestAttribute(java.lang.String itemName, java.lang.Object itemValue)
          Set the value of the named attribute as an Object
 boolean setRequestParameter(java.lang.String itemName, java.lang.String itemValue)
          Sets the value of a request parameter.
 boolean setRequestParameterValues(java.lang.String itemName, java.lang.String[] itemValues)
          Sets the value of a request parameter.
 void setRequestUsername(java.lang.String name)
          Set the username that personalization will use for the duration of this request.
 void setResourceContext(com.ibm.websphere.personalization.resources.ResourceContext resContext)
          Deprecated.  
 boolean setSessionAttribute(java.lang.String itemName, java.lang.Object itemValue)
          Set the value of the named attribute.
 

Field Detail

COPYRIGHT

static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Method Detail

getRequestAttribute

java.lang.Object getRequestAttribute(java.lang.String itemName)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists


setRequestAttribute

void setRequestAttribute(java.lang.String itemName,
                         java.lang.Object itemValue)
Set the value of the named attribute as an Object


removeRequestAttribute

void removeRequestAttribute(java.lang.String itemName)
Remove the value of the named attribute as an Object


getPortletAttribute

java.lang.Object getPortletAttribute(java.lang.String itemName)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists


setPortletAttribute

boolean setPortletAttribute(java.lang.String itemName,
                            java.lang.Object itemValue)
Set the value of the named attribute as an Object


removePortletAttribute

void removePortletAttribute(java.lang.String itemName)
Remove the value of the named attribute as an Object


getPortletSetting

java.lang.Object getPortletSetting(java.lang.String itemName)
Returns the value of the named setting as an Object, or null if no attribute of the given name exists. First checks the portlet entity preferences (edit mode), then checks the init parameters (admin portlets).


getRemoteHost

java.lang.String getRemoteHost()
Returns the hostName (IP address if hostName cannot be determined) of the server requesting the jsp or servlet containing the rule request


getServerName

java.lang.String getServerName()
Returns the hostName (IP address if hostName cannot be determined) of the server processing the rule request


getRequestParameter

java.lang.String getRequestParameter(java.lang.String itemName)
Returns the value of a request parameter as a String, or null if the parameter does not exist.


getRequestInfo

java.lang.String getRequestInfo()

getSessionInfo

java.lang.String getSessionInfo()

setRequestParameter

boolean setRequestParameter(java.lang.String itemName,
                            java.lang.String itemValue)
Sets the value of a request parameter. This is a nop for HttpRequests return true if operation supported, false if not supported


getRequestParameterValues

java.lang.String[] getRequestParameterValues(java.lang.String itemName)
Returns the value of a request parameter as a String, or null if the parameter does not exist.


setRequestParameterValues

boolean setRequestParameterValues(java.lang.String itemName,
                                  java.lang.String[] itemValues)
Sets the value of a request parameter. This is a nop for HttpRequests return true if operation supported, false if not supported


getSessionAttribute

java.lang.Object getSessionAttribute(java.lang.String itemName)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists


setSessionAttribute

boolean setSessionAttribute(java.lang.String itemName,
                            java.lang.Object itemValue)
Set the value of the named attribute. Return true if operation supported, false if not supported


removeSessionAttribute

void removeSessionAttribute(java.lang.String itemName)
Remove the value of the named attribute


getRemoteUser

java.lang.String getRemoteUser()
Used to get remoteUser name from the HttpContext or surrogate. The value will be either a null if the user has not been authenticated.


setRemoteUser

boolean setRemoteUser(java.lang.String userName)
Used to set remoteUser name in the HttpContext surrogate. This is a nop on HttpRequests. return true if operation supported, false if not supported


getLocale

java.util.Locale getLocale()
Used to get locale from the HttpContext or surrogate.


setLocale

boolean setLocale(java.util.Locale locale)
Used to set locale in the HttpContext surrogate. This is a nop on HttpRequests. return true if operation supported, false if not supported


getContextPath

java.lang.String getContextPath()
Used to get contextPath name from the HttpContext or surrogate. Must be supplied for the surrogate case and is used at a minimum to key the scope identity of rules and campaigns


setContextPath

boolean setContextPath(java.lang.String contextPath)
Used to set the application contextPath in the HttpContext surrogate. This is a nop on HttpRequests. return true if operation supported, false if not supported


getCookies

javax.servlet.http.Cookie[] getCookies()
Returns the array of cookies known to the request, or null if none exist.


getCookie

javax.servlet.http.Cookie getCookie(java.lang.String cookieName)
Returns the value of a particular cookie, or null if none exist.


addCookie

boolean addCookie(javax.servlet.http.Cookie cookie)
Sets a cookie. This is a nop for HttpRequests return true if operation supported, false if not supported


getRequestDate

java.util.Date getRequestDate()
Returns the date of the request. The time returned is determined by the PznRequestContext implementer, and is not guaranteed to be an accurate reflection of the time the request was submitted.

Returns:
java.util.Date

getResourceContext

com.ibm.websphere.personalization.resources.ResourceContext getResourceContext()
Deprecated. 

Returns the implementor of the ResourceContext interface. Can return null.

Returns:
ResourceContext

setResourceContext

void setResourceContext(com.ibm.websphere.personalization.resources.ResourceContext resContext)
Deprecated. 

Set the implementor of the ResourceContext interface.


getAuthenticatedUsername

java.lang.String getAuthenticatedUsername()
Returns the username of the Authenticated User. Will return null if no user is logged in.

Returns:
String

getRequestUsername

java.lang.String getRequestUsername()
Returns the username that personalization will use. Can return null if no user has been established.

Returns:
String

setRequestUsername

void setRequestUsername(java.lang.String name)
Set the username that personalization will use for the duration of this request.


getTranslatedUsername

java.lang.String getTranslatedUsername(java.lang.String collectionName)
Returns the username that personalization will use for the specified collection. Can return null if no user has been established.

Returns:
String

get

java.lang.Object get(java.lang.String key)
Get a value from the context. The valid values to get are:

Parameters:
key - java.lang.String
Returns:
java.lang.Object

getApplicationObject

java.lang.Object getApplicationObject(java.lang.String key,
                                      java.lang.String className)
Get the Application Object of the specified key. If the object is not found on the context and the object is a SelfInitializingApplicationObject, the object will be instantiated and initialized. getApplicationObject description

Parameters:
key - The key to use to find the Application Object in the request or session
className - The class of the Application Object, used to instantiate the object if it is not found on the context
Returns:
An Application Object instance.

isPreviewMode

boolean isPreviewMode()
Returns true if this is a preview execution context


getPreviewUserResource

Resource getPreviewUserResource(java.lang.String resourceCollectionPath)
Returns the user Resource instance when in preview mode


getPznRequestObjectInterface

PznRequestObjectInterface getPznRequestObjectInterface()
Returns the PznRequestObjectInterface


clone

java.lang.Object clone()