Ok, some more debugging reveals that this is not a loop, but instead the
filter being present twice in the chain. Since I had a check in place, it
failed on the second invocation, making it look like a loop.

The reason it's in there twice was that I had defined both servletNames and
urlPatterns on the @WebFilter annotation. It‘s not clear to me if it’s
correct behavior to have the filter invoked twice (in the chain twice) when
there's an overlap between servlet names and url patterns.


On Sat, Sep 7, 2013 at 5:07 PM, Nils Kilden-Pedersen <[email protected]>wrote:

> This is 9.0.5.
>
> I'm having an issue with an infinite loop in a filter.
>
> I assume this is a bug, but I don't know enough about the Jetty internals
> to say where exactly.
>
> Basically, my code (the Filter) wraps the request using
> HttpServletRequestWrapper and then calls chain.doFilter(wrappedRequest,
> response)
>
> The chain instance is ServletHandler$CachedChain and doFilter looks like
> this:
>
> 1465        public void doFilter(ServletRequest request, ServletResponse 
> response)1466            throws IOException, ServletException1467        
> {1468            final Request baseRequest=(request instanceof 
> Request)?((Request)request):HttpChannel.getCurrentHttpChannel().getRequest();14691470
>             // pass to next filter1471            if 
> (_filterHolder!=null)1472            {1473                if 
> (LOG.isDebugEnabled())1474                    LOG.debug("call filter " + 
> _filterHolder);1475                Filter filter= 
> _filterHolder.getFilter();1476                if 
> (_filterHolder.isAsyncSupported())1477                    
> filter.doFilter(request, response, _next);1478                else
>
> I have asyncSupported = true and the filter retrieved on line 1475 is my
> filter that just called this method, which it then proceeds to call again
> on line 1477, which leads to the infinite loop.
>
> Hope that's good enough.
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to