Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.webapps.action
Class BaseForwardAction  view BaseForwardAction download BaseForwardAction.java

java.lang.Object
  extended byBaseAction
      extended bycom.RuntimeCollective.webapps.action.BaseForwardAction
Direct Known Subclasses:
BaseUserAction

public class BaseForwardAction
extends BaseAction

A base action which defines the Josephine standard forwards.

ActionForm values stored on the Session using the SessionInput tag are also retrieved and the appropriate properties of the ActionForm are populated.

// :FIXME: Lee Denison (2002/11/13) // :FIXME much of this functionality needs to be moved down to // :FIXME ActionServlet, otherwise ActionServlet needs to pass on some // :FIXME more responsibility when form validation fails.

Version:
$Id: BaseForwardAction.java,v 1.21 2003/09/30 15:13:07 joe Exp $

Field Summary
static java.lang.String CANCEL
          Standard cancelled forward.
static java.lang.String FAILURE
          Standard failure forward.
static java.lang.String FAILURE_KEY
          Key for storing a failure forward that should override the standard one.
static java.lang.String INVALID
          Standard forward that signifies an invalid request.
static java.lang.String ITERATE
          Standard forward indicating that the browser should be forwarded to the input page.
static java.lang.String SUCCESS
          Standard success forward.
static java.lang.String SUCCESS_FORWARD
          Key for storing a success forward that should overide the standard one.
static java.lang.String SUCCESS_KEY
          Key for storing the mapping name of a success forward that should override the standard one.
static java.lang.String SUCCESS_PARAM_MAP
          Key for storing a Map containing parameters to add to a specified success forward.
static java.lang.String TRANSACTION_TOKEN_KEY
          The session attributes key under which our transaction token is stored, if it is used.
 
Constructor Summary
BaseForwardAction()
           
 
Method Summary
protected  org.apache.struts.action.ActionForward findFailure(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  org.apache.struts.action.ActionForward findSuccess(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  org.apache.struts.action.ActionForward forward(javax.servlet.http.HttpServletRequest request, org.apache.struts.action.ActionForward src)
          Substitute request parameters in the url of an ActionForward with values in the request, action, session and application scopes.
private  java.lang.String getBean(javax.servlet.http.HttpServletRequest request, java.lang.String beanName)
           
private  java.lang.String getProperty(javax.servlet.http.HttpServletRequest request, java.lang.String name)
           
static java.lang.String getToken(javax.servlet.http.HttpServletRequest request)
          Returns the valid transaction token stored in the request or null if one could not be found.
protected  boolean isTokenValid(javax.servlet.http.HttpServletRequest 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  void iterate(javax.servlet.http.HttpServletRequest request)
          Set the forward for success to return to the input value.
private  java.lang.Object lookup(javax.servlet.http.HttpServletRequest request, java.lang.String beanName)
           
private  void populateSessionInput(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ActionContext actionCtx)
           
protected  void preProcess(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process this requests transaction information.
private  void removeToken(javax.servlet.http.HttpServletRequest request)
           
protected  void resetToken(javax.servlet.http.HttpServletRequest request)
          Clear the current transaction and move the store to the request store.
 void saveToken(javax.servlet.http.HttpServletRequest request)
          Save a new transaction token and preserve the transaction store.
protected  void setFailureForward(javax.servlet.http.HttpServletRequest request, java.lang.String forwardKey)
          Set the forward for failure to a custom value.
protected  void setSuccessForward(javax.servlet.http.HttpServletRequest request, org.apache.struts.action.ActionForward actionForward)
          Set the forward for success to a custom value.
protected  void setSuccessForward(javax.servlet.http.HttpServletRequest request, java.lang.String forwardKey)
          Set the forward for success to a custom value.
protected  void setSuccessForward(javax.servlet.http.HttpServletRequest request, java.lang.String forwardKey, java.util.Map paramMap)
          Set the forward for success to a custom value.
 void setToken(javax.servlet.http.HttpServletRequest request, java.lang.String token)
           
protected  void validForm(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, java.lang.Class formClass)
          A utility method which makes it easy to ensure that your form is of the type you are expecting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUCCESS

public static final java.lang.String SUCCESS
Standard success forward.

See Also:
Constant Field Values

FAILURE

public static final java.lang.String FAILURE
Standard failure forward.

Returned when the user is making a valid request but the system doesn't execute it. eg. the system failed to lock document X because another user has already locked it.

See Also:
Constant Field Values

INVALID

public static final java.lang.String INVALID
Standard forward that signifies an invalid request.

If a request does not satisfy the preconditions of the mapped action, it should return this forward.

See Also:
Constant Field Values

CANCEL

public static final java.lang.String CANCEL
Standard cancelled forward.

Returned if the user selected to cancel their action.

See Also:
Constant Field Values

ITERATE

public static final java.lang.String ITERATE
Standard forward indicating that the browser should be forwarded to the input page.

See Also:
Constant Field Values

FAILURE_KEY

public static final java.lang.String FAILURE_KEY
Key for storing a failure forward that should override the standard one.

See Also:
Constant Field Values

SUCCESS_KEY

public static final java.lang.String SUCCESS_KEY
Key for storing the mapping name of a success forward that should override the standard one.

See Also:
Constant Field Values

SUCCESS_FORWARD

public static final java.lang.String SUCCESS_FORWARD
Key for storing a success forward that should overide the standard one.

See Also:
Constant Field Values

SUCCESS_PARAM_MAP

public static final java.lang.String SUCCESS_PARAM_MAP
Key for storing a Map containing parameters to add to a specified success forward.

See Also:
Constant Field Values

TRANSACTION_TOKEN_KEY

public static final java.lang.String TRANSACTION_TOKEN_KEY
The session attributes key under which our transaction token is stored, if it is used.

See Also:
Constant Field Values
Constructor Detail

BaseForwardAction

public BaseForwardAction()
Method Detail

setSuccessForward

protected void setSuccessForward(javax.servlet.http.HttpServletRequest request,
                                 java.lang.String forwardKey)
Set the forward for success to a custom value.


setSuccessForward

protected void setSuccessForward(javax.servlet.http.HttpServletRequest request,
                                 org.apache.struts.action.ActionForward actionForward)
Set the forward for success to a custom value.


setSuccessForward

protected void setSuccessForward(javax.servlet.http.HttpServletRequest request,
                                 java.lang.String forwardKey,
                                 java.util.Map paramMap)
Set the forward for success to a custom value.


setFailureForward

protected void setFailureForward(javax.servlet.http.HttpServletRequest request,
                                 java.lang.String forwardKey)
Set the forward for failure to a custom value.


iterate

protected void iterate(javax.servlet.http.HttpServletRequest request)
Set the forward for success to return to the input value.


findFailure

protected org.apache.struts.action.ActionForward findFailure(org.apache.struts.action.ActionMapping mapping,
                                                             org.apache.struts.action.ActionForm form,
                                                             javax.servlet.http.HttpServletRequest request,
                                                             javax.servlet.http.HttpServletResponse response)

findSuccess

protected org.apache.struts.action.ActionForward findSuccess(org.apache.struts.action.ActionMapping mapping,
                                                             org.apache.struts.action.ActionForm form,
                                                             javax.servlet.http.HttpServletRequest request,
                                                             javax.servlet.http.HttpServletResponse response)

forward

protected org.apache.struts.action.ActionForward forward(javax.servlet.http.HttpServletRequest request,
                                                         org.apache.struts.action.ActionForward src)
Substitute request parameters in the url of an ActionForward with values in the request, action, session and application scopes.

Parameters of the form "foo=${bar.foop}" will have bar.getFoop().toString() substituted.

Parameters of the form "foo=#{bar.foop}" assume that bar is an Integer containing the id of an EntityBean. The EntityBean will first be loaded, and then the bean property substituted.

// :FIXME: Lee Denison 2002/11/08 // :FIXME these values shouldn't be parsed from the url string // :FIXME an extended ActionForward class with a correspondingly // :FIXME enhanced struts-config parser should allow the parameter // :FIXME info to be stored in structured xml. This should be // :FIXME extended to allow the preservation of request parameters. // :FIXME something for the form: // :FIXME // :FIXME // :FIXME // :FIXME // :FIXME

If a valid transaction token exists in the current request, it is added to the forward url.


getToken

public static java.lang.String getToken(javax.servlet.http.HttpServletRequest request)
Returns the valid transaction token stored in the request or null if one could not be found.


isTokenValid

protected boolean isTokenValid(javax.servlet.http.HttpServletRequest 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. 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


resetToken

protected void resetToken(javax.servlet.http.HttpServletRequest request)
Clear the current transaction and move the store to the request store.


saveToken

public void saveToken(javax.servlet.http.HttpServletRequest request)
Save a new transaction token and preserve the transaction store. FR: made this public, called from a JSP using the action context


preProcess

protected void preProcess(org.apache.struts.action.ActionMapping mapping,
                          org.apache.struts.action.ActionForm form,
                          javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
Process this requests transaction information.


validForm

protected void validForm(org.apache.struts.action.ActionMapping mapping,
                         org.apache.struts.action.ActionForm form,
                         javax.servlet.http.HttpServletRequest request,
                         java.lang.Class formClass)
A utility method which makes it easy to ensure that your form is of the type you are expecting.


setToken

public void setToken(javax.servlet.http.HttpServletRequest request,
                     java.lang.String token)

removeToken

private void removeToken(javax.servlet.http.HttpServletRequest request)

populateSessionInput

private void populateSessionInput(org.apache.struts.action.ActionMapping mapping,
                                  org.apache.struts.action.ActionForm form,
                                  javax.servlet.http.HttpServletRequest request,
                                  javax.servlet.http.HttpServletResponse response,
                                  ActionContext actionCtx)

getProperty

private java.lang.String getProperty(javax.servlet.http.HttpServletRequest request,
                                     java.lang.String name)

getBean

private java.lang.String getBean(javax.servlet.http.HttpServletRequest request,
                                 java.lang.String beanName)

lookup

private java.lang.Object lookup(javax.servlet.http.HttpServletRequest request,
                                java.lang.String beanName)