Class CleanupSpringRequestAttributesFilter

  • All Implemented Interfaces:
    javax.servlet.Filter

    public class CleanupSpringRequestAttributesFilter
    extends Object
    implements javax.servlet.Filter
    org.springframework.web.filter.RequestContextFilter (and any OncePerRequestFilter) will set a request attribute with an instance of WebAsyncManager (by calling org.springframework.web.context.request.async.WebAsyncUtils#getAsyncManager(javax.servlet.ServletRequest)) If a plugin calls org.springframework.web.context.request.async.WebAsyncUtils#getAsyncManager(javax.servlet.ServletRequest) it will retrieve that instance of WebAsyncManager, but will cause a ClassCastException, as plugins have different Spring classes than core. This filter just removes the attribute, which could be problematic if we want to handle async request properly, so it should be limited to affected urls only. One plugin known to use Spring this way is embedded-crowd-admin-plugin. Class copied from FeCru.
    • Constructor Detail

      • CleanupSpringRequestAttributesFilter

        public CleanupSpringRequestAttributesFilter()
    • Method Detail

      • 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