org.apache.cocoon.environment
Class ObjectModelHelper

java.lang.Object
  extended byorg.apache.cocoon.environment.ObjectModelHelper

public final class ObjectModelHelper
extends Object

A set of constants and methods to access the content of the object model.

The object model is a Map used to pass information about the calling environment to the sitemap and its components (matchers, actions, transformers, etc).

This class provides accessors only for the objects in the object model that are common to every environment and which can thus be used safely. Some environments provide additional objects, but they are not described here and accessing them should be done in due cause since this ties the application to that particular environment.

Version:
$Id: ObjectModelHelper.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
static String CONTEXT_OBJECT
          Key for the environment Context in the object model.
static String EXPIRES_OBJECT
          Key for the expiration value (Long) in the object model.
static String PARENT_CONTEXT
          Key for a Map containing information from a parent request provided to a sub-request (internal processing)
static String REQUEST_OBJECT
          Key for the environment Request in the object model.
static String RESPONSE_OBJECT
          Key for the environment Response in the object model.
static String THROWABLE_OBJECT
          Key for the throwable object, only available within a <map:handle-errors>.
 
Method Summary
static Context getContext(Map objectModel)
          Return Context object stored in the provided objectModel map.
static Long getExpires(Map objectModel)
          Return expires object stored in the provided objectModel map.
static Request getRequest(Map objectModel)
          Return Request object stored in the provided objectModel map.
static Response getResponse(Map objectModel)
          Return Response object stored in the provided objectModel map.
static Throwable getThrowable(Map objectModel)
          Return Throwable object stored in the provided objectModel map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUEST_OBJECT

public static final String REQUEST_OBJECT
Key for the environment Request in the object model.

See Also:
Constant Field Values

RESPONSE_OBJECT

public static final String RESPONSE_OBJECT
Key for the environment Response in the object model.

See Also:
Constant Field Values

CONTEXT_OBJECT

public static final String CONTEXT_OBJECT
Key for the environment Context in the object model.

See Also:
Constant Field Values

EXPIRES_OBJECT

public static final String EXPIRES_OBJECT
Key for the expiration value (Long) in the object model.

See Also:
Constant Field Values

THROWABLE_OBJECT

public static final String THROWABLE_OBJECT
Key for the throwable object, only available within a <map:handle-errors>.

See Also:
Constant Field Values

PARENT_CONTEXT

public static final String PARENT_CONTEXT
Key for a Map containing information from a parent request provided to a sub-request (internal processing)

See Also:
Constant Field Values
Method Detail

getRequest

public static Request getRequest(Map objectModel)
Return Request object stored in the provided objectModel map.

Parameters:
objectModel - current objectModel map
Returns:
request retrieved from the objectModel map

getResponse

public static Response getResponse(Map objectModel)
Return Response object stored in the provided objectModel map.

Parameters:
objectModel - current objectModel map
Returns:
response retrieved from the objectModel map

getContext

public static Context getContext(Map objectModel)
Return Context object stored in the provided objectModel map.

Parameters:
objectModel - current objectModel map
Returns:
context retrieved from the objectModel map

getExpires

public static Long getExpires(Map objectModel)
Return expires object stored in the provided objectModel map.

expires is an expiration timestamp. This object is present in the objectModel only in the context of a pipeline with configured expires parameter.

Parameters:
objectModel - current objectModel map
Returns:
expiration timestamp retrieved from the objectModel map

getThrowable

public static Throwable getThrowable(Map objectModel)
Return Throwable object stored in the provided objectModel map.

Throwable object is present in the objectModel only within a <map:handle-errors> section of the sitemap. When outside of this section, null is returned.

Parameters:
objectModel - current objectModel map
Returns:
throwable retrieved from the objectModel map


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.