Class SpringMiltonFilter

java.lang.Object
io.milton.servlet.SpringMiltonFilter
All Implemented Interfaces:
jakarta.servlet.Filter

public class SpringMiltonFilter extends Object implements jakarta.servlet.Filter
Loads the spring context either from a spring configuration XML file or a spring @Configuration class.

Use contextConfigClass to define the @Configuration class or contextConfigLocation to define the Spring XML configuration file. If any of them is defined, SpringMiltonFilter will try to load a file named applicationContext.xml from the classpath.
If it still fails, only the parent context will be considered.

This filter then gets the bean named milton.http.manager and uses that for Milton processing.

The milton.http.manager bean can either be a HttpManager or it can be a HttpManagerBuilder, in which case a HttpManager is constructed from it

Requests with a path which begins with one of the exclude paths will not be processed by Milton. Instead, for these requests, the filter chain will be invoked so the request can be serviced by JSP or a servlet, etc

This uses an init parameter called milton.exclude.paths, which should be a comma separated list of paths to ignore. For example:

/static,/images,/login.jsp

This allows non-Milton resources to be accessed, while still mapping all URLs to Milton

Author:
bradm
  • Constructor Details

    • SpringMiltonFilter

      public SpringMiltonFilter()
  • Method Details

    • init

      public void init(jakarta.servlet.FilterConfig fc) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.servlet.Filter
      Throws:
      jakarta.servlet.ServletException
    • initSpringApplicationContext

      protected void initSpringApplicationContext(jakarta.servlet.FilterConfig fc)
    • doFilter

      public void doFilter(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse resp, jakarta.servlet.FilterChain fc) throws IOException, jakarta.servlet.ServletException
      Specified by:
      doFilter in interface jakarta.servlet.Filter
      Throws:
      IOException
      jakarta.servlet.ServletException
    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Filter