If a request is not handled within the scope of the GzipHandler, the gzip interceptor is removed so it cannot be used by any subsequent handlers.
If the request is handled, it is left in place to be used by any async handling.
This commit is contained in:
Greg Wilkins 2016-09-02 12:14:23 +10:00
parent 00fe5d032e
commit 0c6c11d79d
1 changed files with 14 additions and 4 deletions

View File

@ -454,11 +454,21 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
}
}
// install interceptor and handle
out.setInterceptor(new GzipHttpOutputInterceptor(this,getVaryField(),baseRequest.getHttpChannel(),out.getInterceptor(),isSyncFlush()));
HttpOutput.Interceptor orig_interceptor = out.getInterceptor();
try
{
// install interceptor and handle
out.setInterceptor(new GzipHttpOutputInterceptor(this,getVaryField(),baseRequest.getHttpChannel(),orig_interceptor,isSyncFlush()));
if (_handler!=null)
_handler.handle(target,baseRequest, request, response);
if (_handler!=null)
_handler.handle(target,baseRequest, request, response);
}
finally
{
// reset interceptor if request not handled
if (!baseRequest.isHandled() && !baseRequest.isAsyncStarted())
out.setInterceptor(orig_interceptor);
}
}
/* ------------------------------------------------------------ */