net.sourceforge.stripes.action
Class ActionBeanContext

java.lang.Object
  extended by net.sourceforge.stripes.action.ActionBeanContext

public class ActionBeanContext
extends Object

Encapsulates information about the current request. Also provides access to the underlying Servlet API should you need to use it for any reason.

Author:
Tim Fennell

Constructor Summary
ActionBeanContext()
           
 
Method Summary
 String getEventName()
          Supplies the name of the event being handled.
 Locale getLocale()
          Gets the Locale that is being used to service the current request.
 HttpServletRequest getRequest()
          Retreives the HttpServletRequest object that is associated with the current request.
 HttpServletResponse getResponse()
          Retrieves the HttpServletResponse that is associated with the current request.
 Resolution getSourcePageResolution()
          Returns a resolution that can be used to return the user to the page from which they submitted they current request.
 ValidationErrors getValidationErrors()
          Returns the set of validation errors associated with the current form.
 void setEventName(String eventName)
          Used by the DispatcherServlet to set the name of the even being handled.
 void setRequest(HttpServletRequest request)
          Used by the DispatcherServlet to set the HttpServletRequest for the current request
 void setResponse(HttpServletResponse response)
          Used by the DispatcherServlet to set the HttpServletResponse that is associated with the current request.
 void setValidationErrors(ValidationErrors validationErrors)
          Replaces the current set of validation errors.
 String toString()
          Returns a String with the name of the event for which the instance holds context, and the set of validation errors, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActionBeanContext

public ActionBeanContext()
Method Detail

getRequest

public HttpServletRequest getRequest()
Retreives the HttpServletRequest object that is associated with the current request.

Returns:
HttpServletRequest the current request

setRequest

public void setRequest(HttpServletRequest request)
Used by the DispatcherServlet to set the HttpServletRequest for the current request

Parameters:
request - the current request

getResponse

public HttpServletResponse getResponse()
Retrieves the HttpServletResponse that is associated with the current request.

Returns:
HttpServletResponse the current response

setResponse

public void setResponse(HttpServletResponse response)
Used by the DispatcherServlet to set the HttpServletResponse that is associated with the current request.

Parameters:
response - the current response

getEventName

public String getEventName()
Supplies the name of the event being handled. While a specific method is usually invoked on an ActionBean, through the use of default handlers ambiguity can arise. This allows ActionBeans to definitively know the name of the event that was fired.

Returns:
String the name of the event being handled

setEventName

public void setEventName(String eventName)
Used by the DispatcherServlet to set the name of the even being handled.

Parameters:
eventName - the name of the event being handled

getValidationErrors

public ValidationErrors getValidationErrors()
Returns the set of validation errors associated with the current form.

Returns:
a Collection of validation errors

setValidationErrors

public void setValidationErrors(ValidationErrors validationErrors)
Replaces the current set of validation errors.

Parameters:
validationErrors - a collect of validation errors

getLocale

public Locale getLocale()
Gets the Locale that is being used to service the current request. This is *not* the value that was submitted in the request, but the value picked by the configured LocalePicker which takes into consideration the locales preferred in the request.

Returns:
Locale the locale being used for the current request
See Also:
LocalePicker

getSourcePageResolution

public Resolution getSourcePageResolution()

Returns a resolution that can be used to return the user to the page from which they submitted they current request. Most useful in situations where a user-correctable error has occurred that was too difficult or expensive to check at validation time. In that case an ActionBean can call setValidationErrors() and then return the resolution provided by this method.

Returns:
Resolution a resolution that will forward the user to the page they came from

toString

public String toString()
Returns a String with the name of the event for which the instance holds context, and the set of validation errors, if any.

Overrides:
toString in class Object


© Copyright 2005, Stripes Development Team.