com.xpn.xwiki.web
Class ActionFilter
java.lang.Object
com.xpn.xwiki.web.ActionFilter
- All Implemented Interfaces:
- javax.servlet.Filter
public class ActionFilter
- extends Object
- implements javax.servlet.Filter
A filter that dispatches requests to the right action, depending on the button that was pressed in the editing form.
This is needed since the browser cannot send the form data to different URLs depending on the button pressed, and an
XHTML form has only one target URL. In previous versions of XWiki this was accomplished using javascript code, with a
fall-back on a pseudo-dispatcher inside the PreviewAction
, which was on obvious case of bad code design.
The filter dispatches requests based on the presence of a request parameter starting with action_ followed
by the name of the struts action that should actually process the request. For example, the button that does
Save and Continue looks like:
<input type="submit" name="action_saveandcontinue" value="..."/>
As a result, when clicking the button, the request is not sent to the form's target (preview), but is
actually forwarded internally to /bin/saveandcontinue/The/Document.
- Since:
- 1.8M1
- Version:
- $Id: b0a144409ec8c2728ddfdcdf3002a49a78b2219f $
Method Summary |
void |
destroy()
|
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
|
void |
init(javax.servlet.FilterConfig filterConfig)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ActionFilter
public ActionFilter()
init
public void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
- Specified by:
init
in interface javax.servlet.Filter
- Throws:
javax.servlet.ServletException
doFilter
public void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
- Specified by:
doFilter
in interface javax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
destroy
public void destroy()
- Specified by:
destroy
in interface javax.servlet.Filter
Copyright © 2004-2013 XWiki. All Rights Reserved.