com.jivesoftware.base.action.util
Class JiveActionMapper
java.lang.Object
com.jivesoftware.base.action.util.JiveActionMapper
- All Implemented Interfaces:
- com.opensymphony.webwork.dispatcher.mapper.ActionMapper
public class JiveActionMapper
- extends java.lang.Object
- implements com.opensymphony.webwork.dispatcher.mapper.ActionMapper
Default action mapper implementation, using the standard *.[ext] (where ext usually "action") pattern. The extension
is looked up from the WebWork configuration key webwork.action.exection.
To help with dealing with buttons and other related requirements, this mapper (and other ActionMapper
s,
we hope) has the ability to name a button with some predefined prefix and have that button name alter the execution
behaviour. The four prefixes are:
- Method prefix - method:default
- Action prefix - action:dashboard
- Redirect prefix - redirect:cancel.jsp
- Redirect-action prefix - redirect-action:cancel
In addition to these four prefixes, this mapper also understands the action naming pattern of foo!bar in
either the extension form (eg: foo!bar.action) or in the prefix form (eg: action:foo!bar). This syntax tells this mapper
to map to the action named foo and the method bar.
Method Prefix
With method-prefix, instead of calling baz action's execute() method (by default if it isn't overriden in xwork.xml
to be something else), the baz action's anotherMethod() will be called. A very elegant way determine which button is
clicked. Alternatively, one would have submit button set a particular value on the action when clicked, and the
execute() method decides on what to do with the setted value depending on which button is clicked.
<ww:form name="baz">
<ww:textfield label="Enter your name" name="person.name"/>
<ww:submit value="Create person"/>
<ww:submit name="method:anotherMethod" value="Cancel"/>
</ww:form>
Action prefix
With action-prefix, instead of executing baz action's execute() method (by default if it isn't overriden in xwork.xml
to be something else), the anotherAction action's execute() method (assuming again if it isn't overriden with
something else in xwork.xml) will be executed.
<ww:form name="baz">
<ww:textfield label="Enter your name" name="person.name"/>
<ww:submit value="Create person"/>
<ww:submit name="action:anotherAction" value="Cancel"/>
</ww:form>
Redirect prefix
With redirect-prefix, instead of executing baz action's execute() method (by default it isn't overriden in xwork.xml
to be something else), it will get redirected to, in this case to www.google.com. Internally it uses
ServletRedirectResult to do the task.
<ww:form name="baz">
<ww:textfield label="Enter your name" name="person.name"/>
<ww:submit value="Create person"/>
<ww:submit name="redirect:www.google.com" value="Cancel"/>
</ww:form>
Redirect-action prefix
With redirect-action-prefix, instead of executing baz action's execute() method (by default it isn't overriden in
xwork.xml to be something else), it will get redirected to, in this case 'dashboard.action'. Internally it uses
ServletRedirectResult to do the task and read off the extension from the webwork.properties.
<ww:form name="baz">
<ww:textfield label="Enter your name" name="person.name"/>
<ww:submit value="Create person"/>
<ww:submit name="redirect-action:dashboard" value="Cancel"/>
</ww:form>
Field Summary |
protected static java.util.Map |
urlMappings
|
Method Summary |
static void |
addURLMapping(java.lang.String urlPrefix,
URLMapping urlMapping)
|
com.opensymphony.webwork.dispatcher.mapper.ActionMapping |
getMapping(javax.servlet.http.HttpServletRequest request)
|
java.lang.String |
getUriFromActionMapping(com.opensymphony.webwork.dispatcher.mapper.ActionMapping mapping)
|
static void |
handleSpecialParameters(javax.servlet.http.HttpServletRequest request,
com.opensymphony.webwork.dispatcher.mapper.ActionMapping mapping)
|
static void |
removeURLMapping(java.lang.String urlPrefix)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
urlMappings
protected static final java.util.Map urlMappings
JiveActionMapper
public JiveActionMapper()
addURLMapping
public static void addURLMapping(java.lang.String urlPrefix,
URLMapping urlMapping)
removeURLMapping
public static void removeURLMapping(java.lang.String urlPrefix)
getMapping
public com.opensymphony.webwork.dispatcher.mapper.ActionMapping getMapping(javax.servlet.http.HttpServletRequest request)
- Specified by:
getMapping
in interface com.opensymphony.webwork.dispatcher.mapper.ActionMapper
handleSpecialParameters
public static void handleSpecialParameters(javax.servlet.http.HttpServletRequest request,
com.opensymphony.webwork.dispatcher.mapper.ActionMapping mapping)
getUriFromActionMapping
public java.lang.String getUriFromActionMapping(com.opensymphony.webwork.dispatcher.mapper.ActionMapping mapping)
- Specified by:
getUriFromActionMapping
in interface com.opensymphony.webwork.dispatcher.mapper.ActionMapper
Copyright © 1999-2006 Jive Software.