Class IgnoreWebAsyncManagerFilter
- java.lang.Object
-
- com.atlassian.confluence.internal.web.filter.spring.IgnoreWebAsyncManagerFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class IgnoreWebAsyncManagerFilter extends Object implements javax.servlet.Filter
This filter exists to work around an issue with plugins that use SpringMVC.Spring's
OncePerRequestFilter
callsWebAsyncUtils.getAsyncManager(ServletRequest)
to get aWebAsyncManager
to determine if the request is asynchronous.getAsyncManager
caches theWebAsyncManager
it creates as an attribute on theServletRequest
.Since the host application and the plugin framework are using Spring classes from different
ClassLoader
s, that cachedWebAsyncManager
causesClassCastException
s for plugins which use SpringMVC.To avoid those exceptions, this filter detects when Spring attempts to cache its
WebAsyncManager
and ignores the call, ensuring it's never added to the request. Each call togetAsyncManager(ServletRequest
will just create a new one, which is then immediately thrown away. But that means the part of the request that is handled in the host application creates instances from itsClassLoader
, and the part that is handled in the plugin framework creates instances from the OSGiClassLoader
.Copied from com.atlassian.stash.internal.web.filters.IgnoreWebAsyncManagerFilter. Keep them in sync!
- Since:
- 5.10
-
-
Constructor Summary
Constructors Constructor Description IgnoreWebAsyncManagerFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain)
void
init(javax.servlet.FilterConfig filterConfig)
-
-
-
Method Detail
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Filter
-
doFilter
public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain filterChain) throws IOException, javax.servlet.ServletException
- Specified by:
doFilter
in interfacejavax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
-
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
- Specified by:
init
in interfacejavax.servlet.Filter
- Throws:
javax.servlet.ServletException
-
-