jodd.madvoc
Class MadvocController

java.lang.Object
  extended by jodd.madvoc.MadvocController
Direct Known Subclasses:
PetiteMadvocController

public class MadvocController
extends java.lang.Object

Madvoc controller invokes actions for action path and renders action results. It also builds action and result paths.


Field Summary
protected  WebApplication webapp
           
 
Constructor Summary
MadvocController(WebApplication webapp)
           
 
Method Summary
protected  java.lang.Object createAction(java.lang.Class actionClass)
          Creates a new action object from ActionConfig.
protected  ActionRequest createActionRequest(ActionConfig cfg, java.lang.Object action, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
          Creates new ActionRequest.
 java.lang.String invoke(java.lang.String actionPath, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
          Invokes action registered to provided action path, Provides action chaining, by invoking next action request.
protected  java.lang.String prepareActionPath(java.lang.String actionPath, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Returns action path that will be used in lookup for action configuration.
 void render(ActionRequest req, java.lang.String resultValue)
          Invokes a result after the action invocation.
 java.lang.String resolveActionPath(ActionConfig cfg)
          Resolves action path from action configuration.By default, action path is build upon the following formula: prefix + classActionPath + methodSeparator + methodActionPath + extension.
 java.lang.String resolveAlias(java.lang.String resultValue)
          Returns resolved alias result value or passed on, if alias doesn't exist.
 java.lang.String resolveResultPath(ActionConfig cfg, java.lang.String resultValue)
          Resolves result path from action configuration and result value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

webapp

protected final WebApplication webapp
Constructor Detail

MadvocController

public MadvocController(WebApplication webapp)
Method Detail

invoke

public java.lang.String invoke(java.lang.String actionPath,
                               javax.servlet.http.HttpServletRequest servletRequest,
                               javax.servlet.http.HttpServletResponse servletResponse)
                        throws java.lang.Exception
Invokes action registered to provided action path, Provides action chaining, by invoking next action request. Returns null if action path has been invoked by this controller, otherwise, string with an action path is returned.

Throws:
java.lang.Exception

prepareActionPath

protected java.lang.String prepareActionPath(java.lang.String actionPath,
                                             javax.servlet.http.HttpServletRequest request,
                                             javax.servlet.http.HttpServletResponse response)
Returns action path that will be used in lookup for action configuration.


render

public void render(ActionRequest req,
                   java.lang.String resultValue)
            throws java.lang.Exception
Invokes a result after the action invocation. If result value is null nothing is rendered - than the action explicitly should take care about the result.

Result value consist of two parts: type and value. Type is optional and, if exists, it is separated by semi-colon from the value. If type is not specified, the default result type is used. Type defines which ActionResult should be used for rendering the value.

Result value is first checked against aliased values. Then, it is resolved and then passed to the founded ActionResult.

Throws:
java.lang.Exception
See Also:
ActionResult.execute(ActionRequest, String)

resolveActionPath

public java.lang.String resolveActionPath(ActionConfig cfg)
Resolves action path from action configuration.By default, action path is build upon the following formula:
prefix + classActionPath + methodSeparator + methodActionPath + extension.
If method action path is empty, it will be omitted.

When method action path starts with prefix, class action path is ignored.


resolveAlias

public java.lang.String resolveAlias(java.lang.String resultValue)
Returns resolved alias result value or passed on, if alias doesn't exist.


resolveResultPath

public java.lang.String resolveResultPath(ActionConfig cfg,
                                          java.lang.String resultValue)
Resolves result path from action configuration and result value. By default, the result value is appended to the class action path and method action path. If result value starts with path prefix, it represent complete path.


createActionRequest

protected ActionRequest createActionRequest(ActionConfig cfg,
                                            java.lang.Object action,
                                            javax.servlet.http.HttpServletRequest servletRequest,
                                            javax.servlet.http.HttpServletResponse servletResponse)
Creates new ActionRequest.


createAction

protected java.lang.Object createAction(java.lang.Class actionClass)
Creates a new action object from ActionConfig.



Copyright ©2008 Jodd Team