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.
Constructor and Description |
---|
ActionFilter() |
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
Copyright © 2004–2015 XWiki. All rights reserved.