Although it is best to explicitly define objects, the REST framework supports the ability to work with the following defined implicit objects:
Object | Description |
---|---|
| Maps the current actor-chain’s |
| Maps a cookie name to a cookie object. |
| Maps a header name to a single string value. |
| Maps a header name to an array of string values. |
| Maps a Nucleus component. |
| Maps a request parameter name to an object value. |
| Maps a request parameter name to a single string value. |
| Maps a request parameter name to an array of string values. |
| This object maps to the current request. |
| This object maps to the user’s session. |
Accessing Actor Context Variables
Actor context variables and attributes are available only for the duration of the actor-chain. Each nested actor-chain or child actor-chain is given a new ActorContext
and ModelMap
, and is unable to reference their parent’s ActorContext
and ModelMap
. However, all actor variables are added to the ActorContext
as attributes, which you can access.
To access ActorContext
, request or session attributes, you can map the attribute to a value using the ${order.id}
syntax or ${commerceItems[0]}
array notation.
For example, you could resolve a Nucleus component using the following EL expression:
${nucleus['/atg/commerce/ShoppingCart'].current}
If a variable name does not start one of the implicit objects listed in the Working with Implicit Objects section, the system will look up the variable in the attributes of the ActorContext
, then in the attributes of the request and finally in the attributes of the session. Note that you should have a separate actor context per actor-chain.
When working with a JSP page and JSPActors
, the JSP c:set
tag saves the variable in a request or session attribute. The attributes that are set using the c:set
tag are accessible in the actor definition and can be referenced in an output element to include in the ModelMap
.
Working with Maps
When working with parameters for mapping, use the objectParam.name
, param.name
or paramValues.name
inputs.
For example, the following actor-chain definition uses the completeQuoteParameters
map string keys and values to obtain quote information using the objectParam
object:
<!-- complete quote--> <actor-chain id="completeQuote" transaction="TX_SUPPORTS"> <form id="quoteFormHandler" name="/atg/commerce/order/purchase/QuoteFormHandler" handle="completeQuote" var="quoteFormHandler"> <input name="orderId" value="${param.orderId}"/> <input name="completeQuoteParameters" value="${objectParam.completeQuoteParameters}"/> <input name="completeQuoteErrorURL" value="${completeQuoteErrorURL != null ? completeQuoteErrorURL : '/model/atg/commerce/order/purchase/ QuoteActor/quote-error'}"/> <input name="completeQuoteSuccessURL" value="${completeQuoteSuccessURL != null ? completeQuoteSuccessURL : '/model/atg/commerce/order/purchase/ QuoteActor/quote-success'}"/> </form> </actor-chain>
The output from this call would be the following, which identifies that the REST class-type is a HashMap
:
{ "atg-rest-class-type":\"java.util.HashMap\", "atg-rest-values":{ "agentId": \"agent007\", "providerNote": \"Quote good until 11/11/14\", "externalId": \"external001\", "expirationDate": \"2014-11-11 11:00\", "orderAdjustment": \"5.0\", } }