info.magnolia.cms.filters
Class ServletDispatchingFilter

java.lang.Object
  extended by info.magnolia.cms.filters.AbstractMgnlFilter
      extended by info.magnolia.cms.filters.ServletDispatchingFilter
All Implemented Interfaces:
MgnlFilter, javax.servlet.Filter

public class ServletDispatchingFilter
extends AbstractMgnlFilter

A filter that dispatches requests to a wrapped servlet. TODO : cache matching URIs ?


Constructor Summary
ServletDispatchingFilter(ComponentProvider componentProvider)
           
 
Method Summary
 void destroy()
          Delegates the destroy() call to the wrapper servlet, then to this filter itself.
 void doFilter(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
          Dispatches the request to the servlet if not already bypassed.
 String getComment()
           
protected  Mapping getMapping()
           
 String getName()
           
 Map getParameters()
           
protected  javax.servlet.Servlet getServlet()
           
 Class<? extends javax.servlet.Servlet> getServletClass()
           
 String getServletName()
           
 void init(javax.servlet.FilterConfig filterConfig)
          Initializes the servlet and its mappings.
protected  void initializeServlet(javax.servlet.FilterConfig filterConfig)
           
protected  javax.servlet.Servlet newServletInstance()
           
 void setComment(String comment)
           
 void setParameters(Map parameters)
           
 void setServletClass(Class<? extends javax.servlet.Servlet> servletClass)
           
 void setServletName(String servletName)
           
 
Methods inherited from class info.magnolia.cms.filters.AbstractMgnlFilter
acceptsEncoding, acceptsGzipEncoding, addAndVerifyHeader, addBypass, addMapping, bypasses, doFilter, getBypasses, getDispatching, getMappings, headerContains, isEnabled, mapsTo, matches, matchesDispatching, setBypasses, setDispatching, setEnabled, setMappings, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletDispatchingFilter

@Inject
public ServletDispatchingFilter(ComponentProvider componentProvider)
Method Detail

getName

public String getName()
Specified by:
getName in interface MgnlFilter
Overrides:
getName in class AbstractMgnlFilter

init

public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
Initializes the servlet and its mappings. ServletConfig is wrapped to take init parameters into account.

Specified by:
init in interface javax.servlet.Filter
Overrides:
init in class AbstractMgnlFilter
Throws:
javax.servlet.ServletException

initializeServlet

protected void initializeServlet(javax.servlet.FilterConfig filterConfig)
                          throws ClassNotFoundException,
                                 javax.servlet.ServletException
Throws:
ClassNotFoundException
javax.servlet.ServletException

newServletInstance

protected javax.servlet.Servlet newServletInstance()
                                            throws ClassNotFoundException
Throws:
ClassNotFoundException

getServlet

protected javax.servlet.Servlet getServlet()

getMapping

protected Mapping getMapping()
Overrides:
getMapping in class AbstractMgnlFilter

destroy

public void destroy()
Delegates the destroy() call to the wrapper servlet, then to this filter itself.

Specified by:
destroy in interface javax.servlet.Filter
Overrides:
destroy in class AbstractMgnlFilter

doFilter

public void doFilter(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     javax.servlet.FilterChain chain)
              throws IOException,
                     javax.servlet.ServletException
Dispatches the request to the servlet if not already bypassed. The request is wrapped for properly setting the pathInfo.

Specified by:
doFilter in class AbstractMgnlFilter
Throws:
IOException
javax.servlet.ServletException

getServletName

public String getServletName()

setServletName

public void setServletName(String servletName)

getServletClass

public Class<? extends javax.servlet.Servlet> getServletClass()

setServletClass

public void setServletClass(Class<? extends javax.servlet.Servlet> servletClass)

getParameters

public Map getParameters()

setParameters

public void setParameters(Map parameters)

getComment

public String getComment()

setComment

public void setComment(String comment)


Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.