446563 - Null HttpChannel.getCurrentHttpChannel() in ServletHandler.doFilter().
Moved the finally block that resets the current HttpChannel and the thread name after the handling of the COMPLETE action. This is necessary because AsyncListener.onComplete() (triggered by the handling of the COMPLETE action) may perform a RequestDispatcher.forward() that requires the current HttpChannel thread local to be set.
This commit is contained in:
parent
1ab6d7398c
commit
c66963126f
|
@ -49,7 +49,6 @@ import org.eclipse.jetty.io.EofException;
|
||||||
import org.eclipse.jetty.server.HttpChannelState.Action;
|
import org.eclipse.jetty.server.HttpChannelState.Action;
|
||||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||||
import org.eclipse.jetty.server.handler.ErrorHandler;
|
import org.eclipse.jetty.server.handler.ErrorHandler;
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.util.SharedBlockingCallback.Blocker;
|
import org.eclipse.jetty.util.SharedBlockingCallback.Blocker;
|
||||||
import org.eclipse.jetty.util.URIUtil;
|
import org.eclipse.jetty.util.URIUtil;
|
||||||
|
@ -406,6 +405,36 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable, H
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (action==Action.COMPLETE)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_state.completed();
|
||||||
|
|
||||||
|
if (!_response.isCommitted() && !_request.isHandled())
|
||||||
|
{
|
||||||
|
_response.sendError(404);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Complete generating the response
|
||||||
|
_response.closeOutput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(EofException|ClosedChannelException e)
|
||||||
|
{
|
||||||
|
LOG.debug(e);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
LOG.warn("complete failed",e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_request.setHandled(true);
|
||||||
|
_transport.completed();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -414,37 +443,6 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable, H
|
||||||
Thread.currentThread().setName(threadName);
|
Thread.currentThread().setName(threadName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action==Action.COMPLETE)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_state.completed();
|
|
||||||
|
|
||||||
if (!_response.isCommitted() && !_request.isHandled())
|
|
||||||
{
|
|
||||||
_response.sendError(404);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Complete generating the response
|
|
||||||
_response.closeOutput();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(EofException|ClosedChannelException e)
|
|
||||||
{
|
|
||||||
LOG.debug(e);
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
LOG.warn("complete failed",e);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
_request.setHandled(true);
|
|
||||||
_transport.completed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("{} handle exit, result {}", this, action);
|
LOG.debug("{} handle exit, result {}", this, action);
|
||||||
|
|
||||||
|
@ -604,7 +602,7 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable, H
|
||||||
|
|
||||||
default:
|
default:
|
||||||
String[] values = value.split(",");
|
String[] values = value.split(",");
|
||||||
for (int i = 0; values != null && i < values.length; i++)
|
for (int i = 0; i < values.length; i++)
|
||||||
{
|
{
|
||||||
expect = HttpHeaderValue.CACHE.get(values[i].trim());
|
expect = HttpHeaderValue.CACHE.get(values[i].trim());
|
||||||
if (expect == null)
|
if (expect == null)
|
||||||
|
|
Loading…
Reference in New Issue