465118 Fixed GzipHandler handling of multiple closes

This commit is contained in:
Greg Wilkins 2015-06-11 12:39:03 +10:00
parent 9e2c578a85
commit cd420d7db5
3 changed files with 8 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
/**
* Simple Jetty FileServer.
@ -47,9 +48,11 @@ public class FileServer
resource_handler.setResourceBase(".");
// Add the ResourceHandler to the server.
GzipHandler gzip = new GzipHandler();
server.setHandler(gzip);
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() });
server.setHandler(handlers);
gzip.setHandler(handlers);
// Start things up! By using the server.join() the server thread will join with the current thread.
// See "http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Thread.html#join()" for more details.

View File

@ -586,6 +586,7 @@ public class HttpOutput extends ServletOutputStream implements Runnable
public void sendContent(ByteBuffer content) throws IOException
{
write(content, true);
closed();
}
/**

View File

@ -287,6 +287,9 @@ public class GzipHttpOutputInterceptor implements HttpOutput.Interceptor
@Override
protected Action process() throws Exception
{
if (_deflater==null)
return Action.SUCCEEDED;
if (_deflater.needsInput())
{
if (BufferUtil.isEmpty(_content))