Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.content
Class ContentContext

    java.lang.Object
      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` Deprecated This variable will always be null, use getP13nContextHandler() instead.
`protected javax.servlet.http.HttpServletRequest` | `request` Deprecated This variable will always be null, use getRequest() instead. The request object is no longer stored in this class. If the old behavior of setting/storing the request in ContentContext is required, see `USE_DEPRECATED_BEHAVIOR`.
`static ContextKey` | `USE_DEPRECATED_BEHAVIOR` Deprecated

Constructor Summary
`ContentContext()` Creates a new ContentContext object.
`ContentContext(javax.servlet.http.HttpServletRequest request)` Deprecated Using this constructor will not set the request, as it's now being set by PortalServletFilter and stored elsewhere. The request can be accessed from getRequest(). If the old behavior of setting/storing the request in ContentContext is required, see `USE_DEPRECATED_BEHAVIOR`. Note, that this boolean needs to be set on this object before setting the request, thus the request will have to be set using setRequest(request) after setting the boolean to true.

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.
`javax.servlet.http.HttpServletRequest` | `getRequest()` Get the current request.
`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` | `setP13nRequest(javax.servlet.http.HttpServletRequest p13nrequest, javax.servlet.http.HttpServletRequest request)` Set the request for this object, using a p13n Request, except use the real request for the entitlement request.
`ContentContext` | `setParameter(ContextKey key, Serializable value)` Stores the specified parameter key and value in the ContentContext object.
`ContentContext` | `setRequest(javax.servlet.http.HttpServletRequest request)` Deprecated This does nothing, as the request object is no longer stored in this class. If the old behavior of setting/storing the request in ContentContext is required, see `USE_DEPRECATED_BEHAVIOR`.
`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 javax.servlet.http.HttpServletRequest request

  Deprecated This variable will always be null, use getRequest() instead. The request object is no longer stored in this class. If the old behavior of setting/storing the request in ContentContext is required, see `USE_DEPRECATED_BEHAVIOR`.
  The request within the context.

### USE_DEPRECATED_BEHAVIOR

    public static final ContextKey USE_DEPRECATED_BEHAVIOR

  Deprecated
  Flag that will allow for the request variable to be set and stored in ContentContext, as was it's behavior in the past. To set this variable, the user would do something like: `Content contentContext = new ContentContext(); contentContext.setParameter(ContentContext.USE_DEPRECATED_BEHAVIOR, new Boolean(true)); contentContext.setRequest(request);`

### handler

    protected transient P13nContextHandler handler

  Deprecated This variable will always be null, use getP13nContextHandler() instead.
  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(javax.servlet.http.HttpServletRequest request)

  Deprecated Using this constructor will not set the request, as it's now being set by PortalServletFilter and stored elsewhere. The request can be accessed from getRequest(). If the old behavior of setting/storing the request in ContentContext is required, see `USE_DEPRECATED_BEHAVIOR`. Note, that this boolean needs to be set on this object before setting the request, thus the request will have to be set using setRequest(request) after setting the boolean to true.

  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 javax.servlet.http.HttpServletRequest getRequest()

  Get the current request. Deprecated behavior: 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. To enable deprecated behavior see `USE_DEPRECATED_BEHAVIOR`.

  Returns
    The request.

### setRequest

    public ContentContext setRequest(javax.servlet.http.HttpServletRequest request)

  Deprecated This does nothing, as the request object is no longer stored in this class. If the old behavior of setting/storing the request in ContentContext is required, see `USE_DEPRECATED_BEHAVIOR`.

  Set the request for this object.

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

### setP13nRequest

    public ContentContext setP13nRequest(javax.servlet.http.HttpServletRequest p13nrequest,
                                         javax.servlet.http.HttpServletRequest request)

  Set the request for this object, using a p13n Request, except use the real request for the entitlement request. This method was added for 9.2 MP1 but is not longer relevant because the request object is no longer stored here. This method just delegates the request to setRequest(HttpServletRequest)

  Parameters
    `p13nrequest` - The p13nRequest to set.
    `request` - THe request to set.
  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`

### 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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.