Command context

Commands can obtain information using the command context. Examples of information available include the user's ID, the user object, the language identifier, and the store identifier.

When writing a command, you have access to the command context by calling the getCommandContext() method of the command's superclass. The command context is set to the controller command when the command is invoked by the component facade. A controller command should propagate the command context to any task or controller commands that are invoked during processing.

In previous releases, the information described in the following list was stored in the Command Context object. With the introduction of Business Context in this release, this information are now stored in various business contexts. Command Context becomes a helper class that wraps on top of these business contexts. One can directly retrieve the same piece of information by retrieving the appropriate business context using the CommandContext.getContext(businessContextName) method. Information that is not available from business contexts, remains available and local to the Command Context object. A command can get the following key information from the command context:

The command context should be used as a read-only object. You should not call its setter methods.


Related concepts
Business context service
Command types


Related reference
Basic URL syntax