com.bankframe.fe.statemachine.ext.connectors.servlet
Class Request

java.lang.Object
  extended by com.bankframe.fe.statemachine.ext.connectors.servlet.Request
All Implemented Interfaces:
IRequest

public class Request
extends Object
implements IRequest


Field Summary
static String APPLICATION_PARAM_NAME
          This is the name of the request parameter that should contain the name of the application being run.
static String EVENT_PARAM_NAME
          The is the name of the request parameter that should contain the name of the event to be processed.
static String FILENAME_EXTENSION
          This is the name of the filename extension that can be used to indicate that the application, state and event names can be taken from the URL path instead of from request parameters.
static String STATE_PARAM_NAME
          This is the name of the request parameter that should contain the name of the state from which the current event is being fired.
 
Constructor Summary
Request(HttpServletRequest request)
          Creates a new Request.
 
Method Summary
 String getApplicationName()
          Returns the name of the application which should handle this request.
 Object getAttribute(String name)
           
 Enumeration getAttributeNames()
           
 String getEventName()
          Returns the name of the event which needs to be handled for this request.
 String getParameter(String name)
           
 Enumeration getParameterNames()
          Returns the names of the parameters contained in this request.
 String[] getParameterValues(String parameterName)
          Returns the values for the parameter of the given name.
 HttpServletRequest getRequest()
           
 String getSessionId()
          Returns the id of the UserSession for this request.
 String getStateId()
          Returns the id of the state from which this request comes.
 void setAttribute(String name, Object value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPLICATION_PARAM_NAME

public static final String APPLICATION_PARAM_NAME
This is the name of the request parameter that should contain the name of the application being run. The value of APPLICATION_PARAM_NAME is 'statemachineAppName'

See Also:
Constant Field Values

STATE_PARAM_NAME

public static final String STATE_PARAM_NAME
This is the name of the request parameter that should contain the name of the state from which the current event is being fired. The value of STATE_PARAM_NAME is 'statemachineStateName'

See Also:
Constant Field Values

EVENT_PARAM_NAME

public static final String EVENT_PARAM_NAME
The is the name of the request parameter that should contain the name of the event to be processed. The value of EVENT_PARAM_NAME is 'statemachineEventName'

See Also:
Constant Field Values

FILENAME_EXTENSION

public static final String FILENAME_EXTENSION
This is the name of the filename extension that can be used to indicate that the application, state and event names can be taken from the URL path instead of from request parameters.

The value of FILENAME_EXTENSION is '.jsm'

If the URL ends with this string then the request will get the application, state and event names from the path instead of from the request parameters.

The exact interpretation of the path is as follows:


Thus the path /org/jstatemachine/demoapp/DemoAppAutoView.xml/Welcome.Logout.jsm identifies the Logout event called from the Welcome state in the DemoAppAutoView application.
The reason for such a complex structure is that is should allow you have a single directory on the web server for each application, containing all the other resources required by the app. (images and the like). References can be kept as relative to the application directory in all your JSPs.

Another important point: If some of the information is not in the path, then it will be taken from the defaults. Thus the path /org/jstatemachine/demoapp/DemoAppAutoView.xml/.jsm will load the start state in the demoapp.
The path /.jsm will load the start state in the default app.
The path /Welcome.Logout.jsm will look for the event in the default application.
The path /Logout.jsm will look for the event Logout from the last recorded state in the default application (to be used in conjunction with the com.bankframe.fe.statemachine.base.StateIdSource parameter, as described in the javadoc for RequestContext.)

See Also:
Constant Field Values
Constructor Detail

Request

public Request(HttpServletRequest request)
Creates a new Request.

Parameters:
request - the HttpServletRequest to wrap.
Method Detail

getApplicationName

public String getApplicationName()
Returns the name of the application which should handle this request. If this returns null the statemachine will use the default application returned by the ApplicationManager.

Specified by:
getApplicationName in interface IRequest
Returns:
the name of the application that should handle this request.

getEventName

public String getEventName()
Returns the name of the event which needs to be handled for this request. This should not return null. If no event name is applicable it can return an empty string.

Specified by:
getEventName in interface IRequest
Returns:
the name of the event for this request.

getSessionId

public String getSessionId()
Returns the id of the UserSession for this request. If this returns null the statemachine will create a new default session.

Specified by:
getSessionId in interface IRequest
Returns:
the ID of the IUserSession associated with this request.

getStateId

public String getStateId()
Returns the id of the state from which this request comes. If this returns null the statemachine will use the root state for the current application.

Specified by:
getStateId in interface IRequest
Returns:
the ID of the state from which this request comes.

getRequest

public HttpServletRequest getRequest()

getParameterNames

public Enumeration getParameterNames()
Description copied from interface: IRequest
Returns the names of the parameters contained in this request.

Specified by:
getParameterNames in interface IRequest
Returns:
the names of the parameters contained in this request.
See Also:
IRequest.getParameterNames()

getParameterValues

public String[] getParameterValues(String parameterName)
Description copied from interface: IRequest
Returns the values for the parameter of the given name.

Specified by:
getParameterValues in interface IRequest
Parameters:
parameterName - the name of the parameter values to return.
Returns:
the values for the parameter of the given name.
See Also:
IRequest.getParameterValues(String)

getAttribute

public Object getAttribute(String name)
See Also:
IRequest.getAttribute(String)

setAttribute

public void setAttribute(String name,
                         Object value)
See Also:
IRequest.setAttribute(String, Object)

getParameter

public String getParameter(String name)
See Also:
IRequest.getParameter(String)

getAttributeNames

public Enumeration getAttributeNames()
See Also:
IRequest.getAttributeNames()


Copyright © 2005, 2007, Oracle. All rights reserved.