com.bea.content
Class ContentContext

java.lang.Object
  extended by com.bea.content.ContentContext
All Implemented Interfaces
Serializable

public class ContentContext
extends Object
implements Serializable

Holds contextual information related to the current CM call in a loosely-structured manner. Contextual information is expressed via (ContextKey key, Object value ) pairs agreed upon by the client and low-level code. It's important that both the code setting the contextual information and the code using the contextual information agree upon the key and the type of object which may be present. Some well-known context keys are defined in com.bea.content.ContextKey

See Also
Serialized Form

Field Summary
protected  P13nContextHandler handler
          The handler within the context.
protected  HttpServletRequest request
          The request within the context.
 
Constructor Summary
ContentContext()
          Creates a new ContentContext object.
ContentContext(HttpServletRequest request)
          Create a ContentContext object.
 
Method Summary
 ContentContext copy()
          Create a copy of this object.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 com.bea.p13n.entitlements.common.EntitlementRequest getEntitlementRequest()
          Return the entitlement request object which is created in conjunction with the HttpServletRequest.
 P13nContextHandler getP13nContextHandler()
          Return the P13n context handler for this context.
 Object getParameter(ContextKey key)
          Retrieves the specified parameter value parameter key must be non-null.
 HttpServletRequest getRequest()
          Get the request contained within this object.
 int hashCode()
          Returns a hash code value for the object.
 boolean hasParameter(ContextKey key)
          Returns true if the specified parameter is set.
 Set<ContextKey> parameterKeySet()
          Returns all public parameter keys.
 ContentContext removeParameter(ContextKey key)
          Remove the specified parameter, if it exists and is not mutable.
 ContentContext setParameter(ContextKey key, Serializable value)
          Stores the specified parameter key and value in the ContentContext object.
 ContentContext setRequest(HttpServletRequest request)
          Set the request for this object.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

request

protected transient HttpServletRequest request
The request within the context.


handler

protected transient P13nContextHandler handler
The handler within the context. This variable is not used by the ContentContext anymore and should not be relied upon.

Constructor Detail

ContentContext

public ContentContext()
Creates a new ContentContext object. Please note that since it is created without the request, certain security roles which are based on request or session might not be evaluated for access to content.


ContentContext

public ContentContext(HttpServletRequest request)
Create a ContentContext object.

Parameters
request - The http request object.
Method Detail

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class Object
Returns
a hash code value for this object.
See Also
Object.equals(java.lang.Object)

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters
obj - the reference object with which to compare.
Returns
true if this object is the same as the obj argument; false otherwise.
See Also
hashCode()

copy

public ContentContext copy()
Create a copy of this object. This does not do a deep copy. The copied object will share the same keys and values as the original ContentContext object.


getRequest

public HttpServletRequest getRequest()
Get the request contained within this object. If this ContentContext has been serialized/deserialized, such as occurs in a Session replication, then the request that is returned will be of type Request. In that case, certain methods in the returned Request object might not be supported.

Returns
The request.

setRequest

public ContentContext setRequest(HttpServletRequest request)
Set the request for this object.

Parameters
request -
Returns
The updated ContentContext.
Throws
RepositoryRuntimeException - if an error happens

getEntitlementRequest

public com.bea.p13n.entitlements.common.EntitlementRequest getEntitlementRequest()
Return the entitlement request object which is created in conjunction with the HttpServletRequest. Will be null if the request is null.

Returns
EntitlementRequest.

getP13nContextHandler

public P13nContextHandler getP13nContextHandler()
                                         throws com.bea.p13n.entitlements.common.EntitlementsException
Return the P13n context handler for this context.

Returns
The handler.
Throws
com.bea.p13n.entitlements.common.EntitlementsException - nfailes.f

setParameter

public ContentContext setParameter(ContextKey key,
                                   Serializable value)
Stores the specified parameter key and value in the ContentContext object. If the specified parameter already exists in the ContentContext and the parameter key is mutable, the existing value will be replaced with the new value.

Immutable keys can only be set once -- an attempt to set an immutable key once it exists will fail.

Parameters
key - The parameter key. The key must be non-null.
value - The parameter value. A null parameter value has the same effect as removing the parameter.
Returns
The updated ContentContext
See Also
ContentListKeys

getParameter

public Object getParameter(ContextKey key)
Retrieves the specified parameter value parameter key must be non-null. Returns null if parameter value not found.

Parameters
key - The key for the parameter value to retrieve.
Returns
The parameter.

hasParameter

public boolean hasParameter(ContextKey key)
Returns true if the specified parameter is set.

Parameters
key - The parameter key. The key must be non-null.
Returns
true if the parameter is set.

removeParameter

public ContentContext removeParameter(ContextKey key)
Remove the specified parameter, if it exists and is not mutable.

Parameters
key - The parameter key. The key must be non-null.
Returns
The updated ContentContext.

parameterKeySet

public Set<ContextKey> parameterKeySet()
Returns all public parameter keys.

Returns
The set of public parameter keys.

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns
a string representation of the object.


Copyright © 2006 BEA Systems, Inc. All Rights Reserved