| com.jcorporate.expresso.core.controller.Controller
All known Subclasses: com.jcorporate.expresso.core.controller.TilesController, com.jcorporate.expresso.core.controller.DBController,
Controller | abstract public class Controller extends Action implements Serializable(Code) | | A sequence of interaction with a user is defined as a "Controller".
An Expresso controller is best thought of as a finite state machine. The only
real difference is that because of the stateless nature of the web, anybody
can reach any state with using the "state" parameter in the URL.
Usually for a web deployment environment, you would derive your own controller
from DBController, which adds a database-backed Security matrix to the
controller's base capabilities. Controllers (and DBControllers) do not necessarily
need to be run inside a servlet environment. If they never downcast their ControllerResponse
object to ServletControllerResponse, the Controller can also be used in products
such as Expresso Webservices, or
See the Expresso Developer's Guide for more information on creating
and using a Controller.
A Controller takes a series of parameters (optional) and then provides
a series of Blocks, Inputs, Outputs, and Transitions to the client
An Input specifies a piece of information we want FROM the client
An Output is a piece of information we supply TO the client
A Transition is an action the client can take from this point - e.g.
further controllers that are followups to this controller
A Block is a collection of Inputs, Outputs, Transitions or other Blocks
See Also: com.jcorporate.expresso.core.controller.DBController See Also: com.jcorporate.expresso.core.controller.SecureIfSetController |
Method Summary | |
protected void | addFinalState(State newFinalState) The constructor of the child object should call addFinalState to define
the last state to be executed for this controller. | protected void | addPromptTransitions(State nextState, ControllerResponse response) If nextState is a prompt state (as determined by the addStatePairing method)
then add a 'next' and 'previous' transitions as required.
A 'next' transition will refer to a prompt state's associated validate state.
A 'previous' transition will refer to the prompt state that precedes the
passed in state. | protected void | addRegDomainParamtoSession(HttpServletRequest req, ControllerRequest creq, String regDomain) | protected void | addRequestedURLtoSession(HttpServletRequest req, ControllerRequest creq) | protected void | addState(State newState) The constructor of the child object should call addState to define
each of the states available in this method. | protected void | addStatePairing(State promptState, State handleState, String stateFormClass) The constructor of the child object should call this method with a pairing of State objects.
The sequence of calls to this method determine the runtime ordering of states.
Parameters: promptState - The state that is part of the 'prompting' workflow Parameters: handleState - The state that is part of the 'processing' workflow Parameters: stateFormClass - The ActionForm name to use throws: NonHandleableException - if there's an error in pairing. | protected void | endTimer(long beginTimer, HttpServletRequest request) Used for logging time of requests. | public ActionForward | execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) Process the specified HTTP request, and create the corresponding HTTP
response (or forward to another web component that will create it).
Return an ActionForward instance describing where and how
control should be forwarded, or null if the response has
already been completed. | protected ActionForm | findControllerForm(ControllerRequest request) Return the Struts ActionForm associated with this controller as specified
in the Struts config file. | protected String | generateToken(ControllerRequest request) Generate a new transaction token, to be used for enforcing a single
request for a particular transaction. | protected ActionForward | getActionForward(ServletControllerRequest req, ActionConfig mapping, ControllerResponse res) | protected Transition | getControllerChainingTransition() Return the transition that will be executed once this controller
completes without errors. | protected Transition | getControllerSecurityTransition() Return the transition that will be executed if any state in this controller
cannot be run because the user does not have sufficient authorization. | public State | getFinalState() Return the final state for this controller. | public String | getInitialState() Get the initial state in a controller. | public synchronized Logger | getLogger() Call from subclass to log into Category with subclass name
will create logger with subclass name as necessary. | public static String[] | getParamValues(ServletControllerRequest request, String paramName) | protected String | getRequestURL(HttpServletRequest req) | final protected String | getSchema() | public synchronized Stack | getSchemaHierarchy() | protected Schema | getSchemaInstance() | public synchronized Stack | getSchemaStack() Retrieve a stack of all schemas. | final public State | getState(String stateName) | final public Hashtable | getStates() | protected String | getString(String stringCode) Convenience version, uses default locale of default db context
IMPORTANT: in general, if there's a ControllerResponse object available,
use ControllerResponse.getString(String) instead, this is able
to return the local language by considering the user's locale. | protected String | getString(String stringCode, Object[] args) Convenience version, uses default locale of default db context
IMPORTANT: In general, if there's a ControllerResponse object available,
use ControllerResponse.getString(String) instead, this is able
to return the local language by considering the user's locale.
Parameters: stringCode - The properties file string code to retrieve Parameters: args - The Object array for i18n formatting. | public String | getTitle() | protected void | handleException(HttpServletRequest req, ControllerRequest creq, String dbName, String userName, Throwable theException) Handle an exception error that is not otherwise caught or handled
by the Controller instance itself. | public static synchronized Controller | instantiate(String className) Factory method to create an Controller from it's name
Do not call this function directly! Use ConfigManager.getControllerFactory()
.getInstance(java.lang.String) instead. | protected boolean | isFinalState(String newState) Return True if the passed in state was added to this controller
as a final state.
Parameters: newState - the state name to use as the final state. | protected boolean | isHandleState(State nextState) Return True if the passed in state was added to this controller
as a handle state. | protected boolean | isPromptState(State nextState) Return True if the passed in state was added to this controller
as a prompt state. | protected boolean | isTokenValid(ControllerRequest request) Return true if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. | protected StateForm | loadStateForm(State nextState, ActionForm controllerForm) Return the state's form with data from the controller's form.
The controller's form is specified in the struts config file. | public ControllerResponse | newState(String newState, ControllerRequest myRequest) This is the method where all of the real work of the controller
is done. | protected String | nextHandleState(State nextState) Return the name of the handle state that is associated with the
passed in prompt state. | protected String | nextPromptState(State nextState) Return the name of the prompt state that is 'next' to the passed
in prompt state in the sequence for this controller. | protected void | populateStateForm(StateForm stateForm, ControllerRequest request) Populate the state form with any matching request parameters. | protected void | postPerform(State nextState, ControllerRequest request, ControllerResponse response) Template Method, allowing a subclass to into actions after the invocation of
any state in this controller.
For example, a common footer for web pages
could be created here, so long as the web pages in question,
with the common footer, were all in the same controller which overrides
this method. | protected void | prePerform(State nextState, ControllerRequest request, ControllerResponse response) Template Method, allowing a subclass to do an action after
any state in this controller is performed. | protected String | previousPromptState(State nextState) Return the name of the prompt state that is 'previous' to the passed
in prompt state in the sequence for this controller. | protected void | processRequestTransitions(State nextState, ControllerRequest request)
This method picks up the following routing parameters from the current request
and builds transition objects from them before the state is invoked.
1. | protected Transition | processTransitions(ControllerRequest request, ControllerResponse response, State nextState) This method is the traffic cop that determines which transition to execute
after a state completes.
1. | protected void | redirectRequest(HttpServletResponse response, String redirectURL) | public void | redirectRequest(ControllerRequest request, ControllerResponse response, String redirectURL) | protected ForwardConfig | remapFromExtension(ForwardConfig fwd, ActionConfig mapping, ServletControllerRequest req) if the extension in the current forward is ".xsl" or ".xslt",
remap the forward to "xml", and set a parameter for the xsl style sheet.
author: Larry Hamel, CodeGuild, Inc.
Parameters: fwd - The ForwardConfig object Parameters: mapping - the ActionConfig for the particular controller instance Parameters: req - the ServletControllerRequest for the request. | protected void | resetToken(ControllerRequest request) Reset the saved transaction token in the user's session. | protected void | saveToken(ControllerRequest request) Save a new transaction token in the user's current session,
creating a new session if necessary. | protected void | setControllerChainingTransition(Transition newControllerChainingTransition) Set the transition that will be executed when this controller completes
successfully. | protected void | setControllerSecurityTransition(Transition newControllerSecurityTransition) Set the transition that will be executed when a user attempts to run
a state he doesn't have authorization on. | public ControllerResponse | setCurrentState(String newState, ControllerRequest params) Convenience method to be able to access the state
as a property from a JSP. | public void | setInitialState(String newInitialState) Set what state to invoke if no state parameter is set. | protected void | setSchema(String schemaClass) Tell this Controller object what Schema it belongs to. | protected void | setSchema(Class schemaClass) Identical to setSchema(String) but provides a typesafe way of passing
parameters. | public void | setupDefaultValues(String dbName) Allows for DBCreate to set up proper default
values for views, etc. | protected void | setupReturnToSender(State nextState, ControllerRequest request) This method is called before a state executes. | protected synchronized void | setupSubclassLog() setup a subclass logger separately from the base controller logger. | public boolean | stateAllowed(String newState, ControllerRequest params) Is this state allowed for the current user? The generic controller
object can't determine this, but the DBController child of this
object checks the database to determine which users can access which
states. | protected void | transition(String newState, ControllerRequest req, ControllerResponse res) | protected void | transition(String newState, Class externalController, ControllerRequest req, ControllerResponse res) | protected void | transition(String newState, ControllerRequest req, ControllerResponse res, boolean clear) Transition to an internal state. | protected void | unloadStateForm(StateForm stateForm, ActionForm controllerForm) Move the state's form data back into the controller's form.
The controller's form is specified in the struts config file. |
CONTROLLER_PARAM_KEY | final public static String CONTROLLER_PARAM_KEY(Code) | | key for putting controller into parameter map
|
CTL_SUCC_STATE | final public static String CTL_SUCC_STATE(Code) | | |
NEWSTATE_EXCEPTION_KEY | final public static String NEWSTATE_EXCEPTION_KEY(Code) | | New state exception key
|
ORIGINAL_URL_KEY | final public static String ORIGINAL_URL_KEY(Code) | | Controller original URL key
|
REQUEST_KEY | final public static String REQUEST_KEY(Code) | | Controller request key
|
RESPONSE_KEY | final public static String RESPONSE_KEY(Code) | | Controller response key
|
RETURN_TO_SENDER_TRAN | final public static String RETURN_TO_SENDER_TRAN(Code) | | |
STATE_ERR_STATE | final public static String STATE_ERR_STATE(Code) | | |
STATE_ERR_TRAN | final public static String STATE_ERR_TRAN(Code) | | |
STATE_PARAM_KEY | final public static String STATE_PARAM_KEY(Code) | | key for putting state into parameter map
|
STATE_SUCC_CTL | final public static String STATE_SUCC_CTL(Code) | | |
STATE_SUCC_STATE | final public static String STATE_SUCC_STATE(Code) | | |
STATE_SUCC_TRAN | final public static String STATE_SUCC_TRAN(Code) | | |
mLog | protected Logger mLog(Code) | | if subclass calls getLogger(), this will create logger with
subclass name
|
Controller | public Controller()(Code) | | Default constructor
|
addFinalState | protected void addFinalState(State newFinalState) throws NonHandleableException(Code) | | The constructor of the child object should call addFinalState to define
the last state to be executed for this controller.
Once the final state is added then no other states can be added via the
addStatePairing method.
Parameters: newFinalState - the new state to use as your final state. throws: NonHandleableException - if you send it an improper final state. |
addPromptTransitions | protected void addPromptTransitions(State nextState, ControllerResponse response) throws ControllerException(Code) | | If nextState is a prompt state (as determined by the addStatePairing method)
then add a 'next' and 'previous' transitions as required.
A 'next' transition will refer to a prompt state's associated validate state.
A 'previous' transition will refer to the prompt state that precedes the
passed in state. The 'previous' state will not be added to the response if
if the passed in state is the first one (iniial state) in this controller.
Parameters: nextState - in this controller the new state add Parameters: response - the ControllerResponse that these transitions will beadded to. throws: ControllerException - upon error. |
addState | protected void addState(State newState)(Code) | | The constructor of the child object should call addState to define
each of the states available in this method.
Parameters: newState - The State object to be added to the list of states for thiscontroller |
addStatePairing | protected void addStatePairing(State promptState, State handleState, String stateFormClass) throws NonHandleableException(Code) | | The constructor of the child object should call this method with a pairing of State objects.
The sequence of calls to this method determine the runtime ordering of states.
Parameters: promptState - The state that is part of the 'prompting' workflow Parameters: handleState - The state that is part of the 'processing' workflow Parameters: stateFormClass - The ActionForm name to use throws: NonHandleableException - if there's an error in pairing. Usuallycaused by a java.lang.IllegalArumentException |
endTimer | protected void endTimer(long beginTimer, HttpServletRequest request)(Code) | | Used for logging time of requests.
Parameters: beginTimer - The start execution time Parameters: request - The HTTPServletRequest to instrument |
execute | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException(Code) | | Process the specified HTTP request, and create the corresponding HTTP
response (or forward to another web component that will create it).
Return an ActionForward instance describing where and how
control should be forwarded, or null if the response has
already been completed. Note, that if you wish to run a controller within
something other than a HTTP session, then call newState directly.
Parameters: mapping - The ActionMapping used to select this instance Parameters: form - The optional ActionForm bean for this request (if any) Parameters: request - The HTTP request we are processing Parameters: response - The HTTP response we are creating The ActionForward or null throws: IOException - if an input/output error occurs throws: ServletException - if a servlet exception occurs |
findControllerForm | protected ActionForm findControllerForm(ControllerRequest request) throws ControllerException(Code) | | Return the Struts ActionForm associated with this controller as specified
in the Struts config file. Struts would have already created and populated
this form and put it either in the request or session scope.
Parameters: request - The ControllerRequest object The appropriate ActionForm for this controller request throws: ControllerException - if unable to find the Controller Form. |
generateToken | protected String generateToken(ControllerRequest request)(Code) | | Generate a new transaction token, to be used for enforcing a single
request for a particular transaction.
Thanks to "Raul DAVIDOVICH" (R.DAVIDOVICH@caconcology.com)
Parameters: request - The request we are processing transaction token usually cryptographically created |
getActionForward | protected ActionForward getActionForward(ServletControllerRequest req, ActionConfig mapping, ControllerResponse res) throws NonHandleableException, ControllerException(Code) | | Determine the forward appropriate for this controller/state,
either from parameters or from configuration files, or from
remapping based on past extensions like .xsl
Parameters: req - the ServletControllerRequest object Parameters: mapping - the ActionConfig that defines the mapping Parameters: res - the ControllerResponse object that has been handed back tous by Controller.newState() an ActionForward instance. throws: NonHandleableException - upon fatal error throws: ControllerException - upon error |
getControllerChainingTransition | protected Transition getControllerChainingTransition()(Code) | | Return the transition that will be executed once this controller
completes without errors. The controller 'completes' once the
final state (as defined using addFinalState) returns without errors
in the error collection.
The Transition for this controller chaining setup. |
getControllerSecurityTransition | protected Transition getControllerSecurityTransition()(Code) | | Return the transition that will be executed if any state in this controller
cannot be run because the user does not have sufficient authorization.
The ControllerSecurity Transition |
getFinalState | public State getFinalState()(Code) | | Return the final state for this controller. See addFinalState().
the "Final" state for this workflow. |
getInitialState | public String getInitialState()(Code) | | Get the initial state in a controller. This is the state to use if there
is no state parameter specified in the requesting URL or
execution container.
The name of the State to use as default for this controller |
getLogger | public synchronized Logger getLogger()(Code) | | Call from subclass to log into Category with subclass name
will create logger with subclass name as necessary.
org.apache.logj.Logger |
getParamValues | public static String[] getParamValues(ServletControllerRequest request, String paramName)(Code) | | Fetches array of parameter values from underlying HTTP request; use this in a web app to access
the underlying parameters in the HTTP request which have the same name; parameters with the same name are not
reflected in the hashtable maintained by ControllerRequest;
Parameters: request - cast ControllerRequest to get required type Parameters: paramName - key to look for among all parameters an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist. |
getSchema | final protected String getSchema()(Code) | | Get the name of the schema object that this Controller belongs to
The schema class name associated with this controller |
getSchemaHierarchy | public synchronized Stack getSchemaHierarchy()(Code) | | Retrieve a stack of all schemas in a 'derived sense'
java.util.Stack with the schema hierarchy ending in ExpressoSchemaat the bottom. |
getSchemaInstance | protected Schema getSchemaInstance()(Code) | | Retrieve a full instance of the Schema object that is associated with
this controller
Schema instance. |
getSchemaStack | public synchronized Stack getSchemaStack()(Code) | | Retrieve a stack of all schemas. hands out actual object instance; singleton for this controller.
java.util.Stack with the schema hierarchy ending in ExpressoSchema at the bottom. never null. |
getState | final public State getState(String stateName)(Code) | | Return a specific state
Parameters: stateName - The name of the state to retrieve the Instantiated State. |
getStates | final public Hashtable getStates()(Code) | | Return the hashtable of valid states for this controller
a Hashtable of states for this controller |
getString | protected String getString(String stringCode)(Code) | | Convenience version, uses default locale of default db context
IMPORTANT: in general, if there's a ControllerResponse object available,
use ControllerResponse.getString(String) instead, this is able
to return the local language by considering the user's locale.
Parameters: stringCode - The properties file string code to retrieve translated string, or if not found, the stringCode |
getString | protected String getString(String stringCode, Object[] args)(Code) | | Convenience version, uses default locale of default db context
IMPORTANT: In general, if there's a ControllerResponse object available,
use ControllerResponse.getString(String) instead, this is able
to return the local language by considering the user's locale.
Parameters: stringCode - The properties file string code to retrieve Parameters: args - The Object array for i18n formatting. translated string, or if not found, the stringCode |
getTitle | public String getTitle()(Code) | | Return the title of this Controller
java.lang.String The Title of the controller |
handleException | protected void handleException(HttpServletRequest req, ControllerRequest creq, String dbName, String userName, Throwable theException) throws ServletException(Code) | | Handle an exception error that is not otherwise caught or handled
by the Controller instance itself. Typically, these will be reserved
for "system failure" type of situations, as anything that the user
can reasonable be expected to correct should be reported in the ErrorCollection
instead.
Parameters: req - The HTTPServletRequest Parameters: creq - The ControllerRequest Object Parameters: dbName - The current data context Parameters: userName - The currently logged in Username Parameters: theException - The java.lang.Throwable object thatwas caught throws: ServletException - upon fatal error for handling the exception |
instantiate | public static synchronized Controller instantiate(String className) throws ControllerException(Code) | | Factory method to create an Controller from it's name
Do not call this function directly! Use ConfigManager.getControllerFactory()
.getInstance(java.lang.String) instead.
Parameters: className - The classname of the controller to instantiated a fully instantiated Controller Object throws: ControllerException - upon construction failure |
isFinalState | protected boolean isFinalState(String newState)(Code) | | Return True if the passed in state was added to this controller
as a final state.
Parameters: newState - the state name to use as the final state. true if this is the final state. |
isHandleState | protected boolean isHandleState(State nextState)(Code) | | Return True if the passed in state was added to this controller
as a handle state.
Parameters: nextState - the state name to check against true if it is supposed to handle the state. |
isPromptState | protected boolean isPromptState(State nextState)(Code) | | Return True if the passed in state was added to this controller
as a prompt state.
Parameters: nextState - the state name to check against true if it is the prompt state. |
isTokenValid | protected boolean isTokenValid(ControllerRequest request)(Code) | | Return true if there is a transaction token stored in
the user's current session, and the value submitted as a request
parameter with this action matches it. Returns false
under any of the following circumstances:
- No session associated with this request
- No transaction token saved in the session
- No transaction token included as a request parameter
- The included transaction token value does not match the
transaction token in the user's session
Parameters: request - The servlet request we are processing boolean value if the request transaction token matchedthe stored transaction token. See Also: Controller.generateToken See Also: Controller.resetToken See Also: Controller.saveToken |
loadStateForm | protected StateForm loadStateForm(State nextState, ActionForm controllerForm) throws ControllerException(Code) | | Return the state's form with data from the controller's form.
The controller's form is specified in the struts config file. The state
form is specified in the state's stateFormClass attribute.
Parameters: nextState - The next state to use Parameters: controllerForm - the ControllerForm as specified in the struts config file. a fully instantiated StateForm throws: ControllerException - if there is an error instantiating the State Form |
newState | public ControllerResponse newState(String newState, ControllerRequest myRequest) throws ControllerException, NonHandleableException(Code) | | This is the method where all of the real work of the controller
is done. The client calls this to indicate what state the
controller is transitioning into.
This is normally what is called from the command line when driving a
Controller object. If running in a struts environment, this function call
is wrapped by execute() method which does the actual running, plus then
performs tasks such as finding the next forward etc.
Parameters: newState - The new state to transition to Parameters: myRequest - The calling controllerRequest object. a newly instantiated ControllerResponse for this state. throws: ControllerException - on Error throws: NonHandleableException - if the error should not be handledby an error controller |
nextHandleState | protected String nextHandleState(State nextState)(Code) | | Return the name of the handle state that is associated with the
passed in prompt state. Null will be returned if the passed in
state is not a prompt state.
Parameters: nextState - the next state to check against the name of the 'handle' state paired with the nextState parameter |
nextPromptState | protected String nextPromptState(State nextState)(Code) | | Return the name of the prompt state that is 'next' to the passed
in prompt state in the sequence for this controller. If the
passed in state is the last prompt state in this controller then
null will be returned.
Parameters: nextState - the next state to check against the name of the 'prompt' state paired with the nextState parameter |
populateStateForm | protected void populateStateForm(StateForm stateForm, ControllerRequest request) throws ControllerException(Code) | | Populate the state form with any matching request parameters.
Parameters: stateForm - The name of the state form to populate Parameters: request - The source of the variables for the state form. throws: ControllerException - upon BeanUtils.populate() error |
postPerform | protected void postPerform(State nextState, ControllerRequest request, ControllerResponse response) throws ControllerException(Code) | | Template Method, allowing a subclass to into actions after the invocation of
any state in this controller.
For example, a common footer for web pages
could be created here, so long as the web pages in question,
with the common footer, were all in the same controller which overrides
this method. (Multiple controllers which need common pre/post actions
could share a common superclass.)
Parameters: nextState - the state to be performed Parameters: request - the request object Parameters: response - the response object |
prePerform | protected void prePerform(State nextState, ControllerRequest request, ControllerResponse response) throws ControllerException(Code) | | Template Method, allowing a subclass to do an action after
any state in this controller is performed.
For example, a common header for the web pages
could be created here, so long as the web pages in question,
with the common header, were all in the same controller which overrides
this method.
Parameters: nextState - the state to be performed Parameters: request - the request object Parameters: response - the response object |
previousPromptState | protected String previousPromptState(State nextState)(Code) | | Return the name of the prompt state that is 'previous' to the passed
in prompt state in the sequence for this controller. If the
passed in state is the first prompt state in this controller then
null will be returned.
Parameters: nextState - The state to check against the previous prompt state |
processRequestTransitions | protected void processRequestTransitions(State nextState, ControllerRequest request) throws ControllerException(Code) | |
This method picks up the following routing parameters from the current request
and builds transition objects from them before the state is invoked.
1. "Controller Success"
These parameters identify the state that should be run once this
controller completes successfully (ie the'final' state has completed without errors).
Any controller success parameters will cause this method to put a
serialized transition object specific to this controller in session scope.
2. "State Success"
These parameters identify the state that should be run if this state
completes without errors.
Any state success parameters will cause this method to assign a
transition object to this currently running state.
3. "State Error"
These parameters identify the state that should be run if this state
completes with errors.
Any state error parameters will cause this method to assign a
transition object to this currently running state.
Note, the transition specified at this time can be overridden by
the state when it executes.
Parameters: nextState - the next state to check process Parameters: request - The controllerRequest object throws: ControllerException - upon error. |
processTransitions | protected Transition processTransitions(ControllerRequest request, ControllerResponse response, State nextState) throws ControllerException, NonHandleableException(Code) | | This method is the traffic cop that determines which transition to execute
after a state completes.
1. "State Error"
The state returned with errors in the error collection. The 'error transition'
associated with the state is executed. This transition could have been set
either in processRequestTransitions() prior to state execution or in the
state itself during execution.
2. "State Success"
The state returned without errors in the error collection. The following
priority is followed:
- If the 'success transition' is not null for this state then it is executed.
- If the state that just completed is a final state then:
- If the 'chaining transition' is not null for this controller then it is executed.
- If the 'controller success transition' is not null for this controller then
it is executed.
Parameters: request - The ControllerRequest Object Parameters: response - The ControllerResponse Object Parameters: nextState - the state to transition to. An instantiated Transition Object throws: NonHandleableException - upon a fatal error. |
redirectRequest | protected void redirectRequest(HttpServletResponse response, String redirectURL) throws IOException(Code) | | redirect response so that URL changes in client browser
Parameters: response - The Servlet Response Parameters: redirectURL - The URL to redirect the browser to. throws: IOException - upon browser error. |
redirectRequest | public void redirectRequest(ControllerRequest request, ControllerResponse response, String redirectURL) throws IOException(Code) | | redirect response so that URL changes in client browser
Parameters: request - The ControllerRquest object. Parameters: response - The ControllerResponse object Parameters: redirectURL - The URL to redirect the browser to. throws: IOException - upon redirect error. |
remapFromExtension | protected ForwardConfig remapFromExtension(ForwardConfig fwd, ActionConfig mapping, ServletControllerRequest req) throws ControllerException(Code) | | if the extension in the current forward is ".xsl" or ".xslt",
remap the forward to "xml", and set a parameter for the xsl style sheet.
author: Larry Hamel, CodeGuild, Inc.
Parameters: fwd - The ForwardConfig object Parameters: mapping - the ActionConfig for the particular controller instance Parameters: req - the ServletControllerRequest for the request. ForwardConfig instance. throws: ControllerException - upon error |
resetToken | protected void resetToken(ControllerRequest request)(Code) | | Reset the saved transaction token in the user's session. This
indicates that transactional token checking will not be needed
on the next request that is submitted.
Parameters: request - The servlet request we are processing See Also: Controller.saveToken See Also: Controller.isTokenValid |
setControllerChainingTransition | protected void setControllerChainingTransition(Transition newControllerChainingTransition) throws NonHandleableException(Code) | | Set the transition that will be executed when this controller completes
successfully. This will not likely be used as often as the runtime
'controller success' routing parameters. However when used, it will
relay any 'controller success' parameters onto the next controller
so that the return path is not lost.
Parameters: newControllerChainingTransition - The new transition for when thecontroller completes successfully. throws: NonHandleableException - upon incorrect parameters. |
setControllerSecurityTransition | protected void setControllerSecurityTransition(Transition newControllerSecurityTransition)(Code) | | Set the transition that will be executed when a user attempts to run
a state he doesn't have authorization on. As always, this transition
can have return-to-sender enabled. This could allow a login screen
to be called and then control would automatically return to the
state whose authorization failed.
Parameters: newControllerSecurityTransition - To execute. |
setInitialState | public void setInitialState(String newInitialState)(Code) | | Set what state to invoke if no state parameter is set.
Parameters: newInitialState - The state to use as the initial state. |
setSchema | protected void setSchema(String schemaClass)(Code) | | Tell this Controller object what Schema it belongs to. This is used
when the Controller tries to use it's "getString(String, Object[])"
method to prepare internationalized messages - it passes the call
along to the appropriate schema which knows how to locate the
proper message file.
Parameters: schemaClass - The classname of the Schema to associate with. |
setSchema | protected void setSchema(Class schemaClass)(Code) | | Identical to setSchema(String) but provides a typesafe way of passing
parameters. Example:
setSchema(com.jcorporate.expresso.core.ExpressoSchema
.class);
Parameters: schemaClass - The Class of the schema to set |
setupDefaultValues | public void setupDefaultValues(String dbName) throws DBException(Code) | | Allows for DBCreate to set up proper default
values for views, etc.
Parameters: dbName - the name of the db to add these values to. throws: DBException - upon error |
setupReturnToSender | protected void setupReturnToSender(State nextState, ControllerRequest request) throws ControllerException(Code) | | This method is called before a state executes. It will assign a
return-to-sender transition to the state. This transition will
include the parameters that this state is being called with.
If this state causes a transition (with return-to-sender enabled) to
be executed, then this state's return-to-sender transition will be
serialized and passed to the next controller. This controller will
then use this transition (once the controller completes successfull)
to return to this state with the same parameters that this state was
initally called with.
This method will also check for a request parameter that overrides the
return-to-sender transition that would normally be associated with this
state. This is useful when the final state reruns all of the controller's
handle states. In that case, any transitions should return to the final
state and not the handle state that caused the transition.
Parameters: nextState - = The state that is about to be executed Parameters: request - The parsed ControllerRequest object throws: ControllerException - upon error. |
setupSubclassLog | protected synchronized void setupSubclassLog()(Code) | | setup a subclass logger separately from the base controller logger.
Is this right? *PP*
|
stateAllowed | public boolean stateAllowed(String newState, ControllerRequest params) throws ControllerException(Code) | | Is this state allowed for the current user? The generic controller
object can't determine this, but the DBController child of this
object checks the database to determine which users can access which
states.
Parameters: newState - The name of the state being checked Parameters: params - The ControllerRequestObject True if the state is allowed, else false if it is not throws: ControllerException - upon error |
transition | protected void transition(String newState, ControllerRequest req, ControllerResponse res, boolean clear) throws ControllerException, NonHandleableException(Code) | | Transition to an internal state. By internal state we mean that this method
is used for transitioning to another 'state' inside the same controller class
[inherited states not withstanding]. You cannot, however use this method
to transfer control between controllers
Parameters: newState - the state to transition to Parameters: req - The ControllerRequest object that has been given your statehandler Parameters: res - The ControllerResponse object that has been given to yourstate handler Parameters: clear - Should existing ControllerElements (Input/Output/Block/Transition)be removed from the resulting ControllerResponse (set to true if that is thedesired behavior) throws: ControllerException - upon error throws: NonHandleableException - upon fatal error |
unloadStateForm | protected void unloadStateForm(StateForm stateForm, ActionForm controllerForm) throws ControllerException(Code) | | Move the state's form data back into the controller's form.
The controller's form is specified in the struts config file. The state's
form is specified in the state's stateFormClass attribute.
Parameters: stateForm - The stateForm to unload Parameters: controllerForm - The associated controllerForm throws: ControllerException - upon error transferring the data betweenthe forms. |
|
|