Expresso 5-6

com.jcorporate.expresso.core.controller
Class ServletControllerResponse

java.lang.Object
  extended bycom.jcorporate.expresso.core.controller.ControllerResponse
      extended bycom.jcorporate.expresso.core.controller.ServletControllerResponse
All Implemented Interfaces:
Serializable

public class ServletControllerResponse
extends ControllerResponse

A ServletControllerResponse object is an extension that provides wide access to the pure Struts API and Servlet environment. For example you may want to generate dynamic ActionForwards or retrieve access to the ActionMapping class.

 public AcmeController extends DBController {
 

protected void runProcessOrderState( ControllerRequest req, ControllerRequest res ) { ServletControllerRequest request = (ServletControllerRequest)req; ActionMapping mapping = request.getMapping();

ServletControllerResponse request = (ServletControllerRequest)req; ActionMapping mapping = response.getMapping();

// ... after processing this state ...

response.setActionForward( new ActionForward( ... ));

// OR

response.setActionForward( repsonse.findForward( "logical-forward-name" ));

// OR

response.setFindForwardStore( "logical-forward-name" );

// OR

response.setForwardName( "logical-forward-name" ); // equivalent to response.setStyle( "logical-forward-name" ) } ... }

Version:
$Id: ServletControllerResponse.java,v 1.6 2004/11/17 20:48:06 lhamel Exp $
Author:
Peter Pilgrim, Fri Nov 22 03:11:09 GMT 2002
See Also:
Serialized Form

Field Summary
protected  org.apache.struts.action.ActionForward myForward
          The associated action forward
 
Fields inherited from class com.jcorporate.expresso.core.controller.ControllerResponse
blockCache, blockCacheOrdered, currentState, customResponse, dataContext, inputCache, inputCacheOrdered, myControllerClass, myRequest, myRequestPath, outputCache, outputCacheOrdered, requestedState, responseLocale, style, title, transitionCache, transitionCacheOrdered
 
Constructor Summary
ServletControllerResponse()
          Default constructor for the servlet controller response
 
Method Summary
 org.apache.struts.action.ActionForward findForward(String forwardName)
          Searches for the action forward associated with the action mapping (controller).
 org.apache.struts.action.ActionForward findForwardStore(String forwardName)
          Searches for the action forward associated with the action mapping (controller), with the side-effect of storing the action forward in the controller response.
 org.apache.struts.action.ActionForward getActionForward()
          Gets the action forward that the controller should forward or redirect to
 String getForwardName()
          Gets the logical name of the action forward that the controller should forward or redirect to.
 org.apache.struts.action.ActionMapping getMapping()
          Gets the ActionMapping associated with the controller .
 void setActionForward(org.apache.struts.action.ActionForward forward)
          Sets the action forward that the controller should forward or redirect to
 void setForwardName(String forwardName)
          Sets the logical name of the action forward that the controller should forward or redirect to.
 
Methods inherited from class com.jcorporate.expresso.core.controller.ControllerResponse
add, addAutoInput, addAutoInput, addAutoInput, addAutoInput, addAutoInput, addAutoInput, addAutoInputRenameField, addBlock, addError, addError, addError, addError, addInput, addOutput, addTransition, autoValidate, autoValidate, clearAttributes, clearBlockCache, clearFormCache, clearInputCache, clearOutputCache, clearTransitionCache, fromXML, getAttribute, getAttributes, getBlock, getBlocks, getControllerClass, getCurrentState, getDataContext, getDBName, getDefaultForm, getErrors, getFormCache, getFormCache, getFormCacheAttribute, getInput, getInputs, getLocale, getName, getNamedBlocks, getNamedInputs, getNamedOutputs, getNamedTransitions, getNestedMap, getOutput, getOutputContent, getOutputRequired, getOutputs, getParameter, getRequest, getRequestedState, getRequestPath, getSchema, getSchemaStack, getString, getString, getString, getString, getString, getString, getStyle, getTitle, getTitleKey, getTransition, getTransitions, getUser, hasErrors, hasErrors, isCustomResponse, restoreForm, saveErrors, setAttribute, setAttributes, setControllerClass, setCustomResponse, setDBName, setFormCache, setFormCache, setFormCacheAttribute, setRequest, setRequestPath, setSchema, setSchemaStack, setStyle, setTitle, setUser, toXML, validate, validState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myForward

protected org.apache.struts.action.ActionForward myForward
The associated action forward

Constructor Detail

ServletControllerResponse

public ServletControllerResponse()
Default constructor for the servlet controller response

Method Detail

getMapping

public org.apache.struts.action.ActionMapping getMapping()
                                                  throws ControllerException
Gets the ActionMapping associated with the controller . Functionally to equivalent to ((ServletControllerRequest)getRequest()).getMapping()

Throws:
ClassCastException - if the associated controller request object is not a ServletControllerRequest type.
ControllerException - if there is no associated controller request object at all.
See Also:
ServletControllerRequest.getMapping()

getActionForward

public org.apache.struts.action.ActionForward getActionForward()
Gets the action forward that the controller should forward or redirect to

Returns:
forward the action forward object
See Also:
setActionForward(org.apache.struts.action.ActionForward)

setActionForward

public void setActionForward(org.apache.struts.action.ActionForward forward)
Sets the action forward that the controller should forward or redirect to

Parameters:
forward - the action forward object
See Also:
getActionForward()

findForward

public org.apache.struts.action.ActionForward findForward(String forwardName)
                                                   throws ControllerException
Searches for the action forward associated with the action mapping (controller). A convenience function for pure Struts programmer function equivalent to getMapping().findForward("{logical-forward-name}")

Parameters:
forwardName - the logical name of the action forward
Returns:
ActionForward with matching logical name or null if none can be found.
Throws:
ClassCastException - if the associated controller request object is not a ServletControllerRequest type.
ControllerException - if there is no associated controller request object at all.
See Also:
getMapping()

findForwardStore

public org.apache.struts.action.ActionForward findForwardStore(String forwardName)
                                                        throws ControllerException
Searches for the action forward associated with the action mapping (controller), with the side-effect of storing the action forward in the controller response.

Functionally equivalent to setActionForward( getMapping().findForward( "{logical-fwd-name}" ))

Parameters:
forwardName - the logical name of the action forward
Returns:
ActionForward with matching logical name or null if none can be found.
Throws:
ClassCastException - if the associated controller request object is not a ServletControllerRequest type.
ControllerException - if there is no associated controller request object at all.
See Also:
getMapping()

getForwardName

public String getForwardName()
Gets the logical name of the action forward that the controller should forward or redirect to. This is an alias for setStyle method. It makes a lot more sense to pure Struts developers who moving upto Expresso. Functionally equivalent to setStyle()

Returns:
the logical name of the action forward
See Also:
setForwardName(java.lang.String), ControllerResponse.getStyle()

setForwardName

public void setForwardName(String forwardName)
Sets the logical name of the action forward that the controller should forward or redirect to. This is an alias for setStyle method. It makes a lot more sense to pure Struts developers who moving upto Expresso. Functionally equivalent to setStyle()

Parameters:
forwardName - the logical name of the action forward
See Also:
getForwardName(), ControllerResponse.setStyle(java.lang.String)

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.