Command
s are used to issue stateless directives to the application container. Commands are executed by passing Command
instances to the ApplicationInstance.enqueueCommand()
method. Once a command has been queued it cannot be undone.
The following example shows a command being enqueued that will open a URL in a new browser window (assuming app
is an ApplicationInstance
):
app.enqueueCommand( new BrowserOpenWindowCommand("http://www.nextapp.com", "nextapp", "width=640,height=480"));
The Web Application Container makes use of Command
s for setting cookies, redirecting to URLs, and launching new browser windows to display arbitrary URLs:
The BrowserRedirectCommand
is used to redirect from a running Echo application to an arbitrary URL. It is critical that only one such command be issued at a time. The state of the Echo application will be preserved, in the event that the user is later directed back to it. See the BrowserRedirectCommand API Specification for more information.
The BrowserOpenWindowCommand
provides for the opening of new browser windows displaying arbitrary URLs. Use of this command may often be overridden by a user's browser if it has been configured to block pop-up windows. See the BrowserOpenWindowCommand API Specification for more information.
The BrowserSetCookieCommand
enables the application to set HTTP cookies on the user's browser client. See the BrowserSetCookieCommand API Specification for more information.