public class RequestContext extends Object
Supplied as an optional parameter to @BeforeAction and @AfterAction methods.
An instance of this class can be made available to intercepting action methods, simply by writing the method signature with it as a parameter. It contains a reference to the servlet request and response objects, as well as to the Java parameters sent in the request, and to the String names of the action and controller being invoked in this request.
For example, the following method demonstrates its usage:
@BeforeAction public void doSomethingBefore(RequestContext ctx) { // do something }
Developers should note that while all the fields are declared final, the class is not completely immutable, as it exports state through the request, response, and paramters objects. When an accessor is called for one of these fields, a reference to the actual object, not to a copy, is returned.
Constructor and Description |
---|
RequestContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Object[] parameters,
String action,
String controller) |
Modifier and Type | Method and Description |
---|---|
String |
getAction()
Gets the action invoked for this request, or an empty String if the
default action was invoked.
|
String |
getController()
Gets the controller invoked for this request, or an empty String if the
default controller was invoked.
|
Object[] |
getParameters()
Gets the parameters associated with the request, as their Java types as
defined in the Action signature.
|
javax.servlet.http.HttpServletRequest |
getRequest()
Gets the HttpServletRequest associated with the request.
|
javax.servlet.http.HttpServletResponse |
getResponse()
Gets the HttpServletResponse associated with the request.
|
public javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public Object[] getParameters()
public String getAction()
public String getController()
Copyright © 2011-2012 MojaveMVC.org