|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
jodd.servlet.ActionServlet
jodd.servlet.ActionController
Represents a controller part of mvc2 framework.
During initialization, configuration xml file is read and all data are
loaded by controller. When request is received, controller will lookup for
the adequate ActionServlet.doAction()
or defined mapped
method to invoke. Depending of the resulting string and the configuration,
controller will perform forwarding or redirection to the destination view.
Controller allows intercepting of all invoked actions, by using the ActionFilter.
ActionServlet
,
ActionFilter
,
Serialized FormField Summary | |
static java.lang.String |
ACTION_DATA
Unique request parameter name that holds ActionData for the current invoked action, as defined in the configuration xml file. |
static java.lang.String |
ACTION_NOT_FOUND
Unique global forward name that will be used in case when action is not mapped to a request. |
static java.lang.String |
ACTION_PATH
Unique request parameter name that holds action path of the the current invoked action, as defined in the configuration xml file. |
static java.lang.String |
INVOKE_ACTION_PARAMS
Unique global forward name that will be used in case when action is not mapped to a request. |
Fields inherited from class jodd.servlet.ActionServlet |
parameterActionName, parameterForwardName, parameterRedirectName |
Constructor Summary | |
ActionController()
|
Method Summary | |
void |
doRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Request dispatcher - the controller. |
void |
init(javax.servlet.ServletConfig config)
Initialization of the controler. |
java.lang.String |
invokeAction(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String actionPath)
Invoke specified action as it would be invoked by ActionController. |
void |
reload()
Reloads configuration XML files. |
Methods inherited from class jodd.servlet.ActionServlet |
doAction, doGet, doPost, forward, forwardParam, forwardParam, getActionForwardPath, getActionMethodName, getActionParameter, getActionPath, getActionType, getController, invokeAction, invokeExternalAction, isActionForwardRedirect, redirect, redirectParam, redirectParam |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.lang.String ACTION_DATA
ActionData
public static java.lang.String ACTION_PATH
public static java.lang.String ACTION_NOT_FOUND
public static java.lang.String INVOKE_ACTION_PARAMS
Constructor Detail |
public ActionController()
Method Detail |
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
config
- actionsMap
javax.servlet.ServletException
reload()
public void reload() throws javax.servlet.ServletException
javax.servlet.ServletException
public void doRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException
The request uri will be processed first. Controller will try to find specific Action type (defined in actions xml configuration file). Very first time when action is required its class (child of ActionServlet) will be loaded and instanced. Next time, actions instance will be found in the buffer, so actions will be instanced just once (when accessed first time).
If Action can not be found, controller will forward to ACTION_NOT_FOUND global forward mapping.
Method doAction() will be invoked on founded action. This method returns a string that represents a forward name (defined in actions xml configuration file). Alternatively, if defined so, mapped method will be invoked.
On the end, controller will perform forward or redirection to path defined with returned forward name string (that doAction() returns), as defined in configuration file. If forward name can not be found, then global forwards will be examined. If global forward can not be found, that it is assumed that no forwards are used, and that returned string represents a page.
doRequest
in class ActionServlet
request
- response
-
java.io.IOException
javax.servlet.ServletException
ActionServlet.doAction(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public java.lang.String invokeAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String actionPath) throws java.io.IOException, javax.servlet.ServletException
NOTE: request parameters are passed from the current request!!! Instead, they are passed as a HashMap in request attribute under the key: INVOKE_ACTION_PARAMS.
invokeAction
in class ActionServlet
request
- http requestresponse
- http responseactionPath
- action path, as defined in configuration xml file
java.io.IOException
javax.servlet.ServletException
doRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |