Business context object
A BusinessContextType object is used to represent the business contextual information defined for the portlet. This contextual information should be set into this object for synchronizing with WebSphere Commerce services.
There are two types of business contextual information - sticky and non-sticky. Sticky business contextual information is session information that lasts for the entire Portal session. The business context object for this sticky contextual information is stored in the portlet session, using a contextKey as the identifier, so that it can be shared and re-used for future access.
Non-sticky contextual information lasts only for the duration of a request. An example of this type is the additional context data provided on the JSP page using the getData tag. Although it is processed in the same way when sending over to the client library, after the response comes back the non-sticky contextual information is discarded and is therefore not available for future uses.
The following two business context values must be present in the business context object:
- langId
- A numeric constant that represents the language used for WebSphere Commerce service
- storeId
- A numeric identifier that represents the WebSphere Commerce store
In order to retrieve an existing business context object from the portlet session, you can write the following code to call a special helper class using a contextKey:
BusinessContextType businessContextType = SessionHelper.getBusinessContextType(portletRequest, contextKey);
If you are planning to create or manage these business context objects at runtime, a business context plug-in is provided with the MVC Portlet. For more information about this business context plug-in, see the Business context plug-in topic.