Я только что обновил свой веб-сервер от Jetty 6.x до Jetty 8.0.1, и по какой-то причине, когда я делаю тот же запрос, иногда ответ был Gzipped, а иногда и нет.Jetty 8 GzipFilter иногда не применяется
Вот что запрос и ответ выглядеть в начале метода службы() сервлета:
Request: [GET /test/hello_world?param=test]@11538114 [email protected]
Response: [email protected]
WORKED!
Request:[GET /test/hello_world?param=test]@19386718 [email protected]
Response:HTTP/1.1 200
Connection: close
FAILED!
Вот моя GzipFilter декларация:
EnumSet<DispatcherType> all = EnumSet.of(DispatcherType.ASYNC, DispatcherType.ERROR, DispatcherType.FORWARD,
DispatcherType.INCLUDE, DispatcherType.REQUEST);
FilterHolder gzipFilter = new FilterHolder(new GzipFilter());
gzipFilter.setInitParameter("mimeTypes", "text/javascript");
gzipFilter.setInitParameter("minGzipSize", "0");
context.addFilter(gzipFilter, "/test/*", all);
Javadoc говорит, что :
GZIP Filter This filter will gzip the content of a response if:
The filter is mapped to a matching path ==>
The response status code is >=200 and <300
The content length is unknown or more than the minGzipSize initParameter or the minGzipSize is 0(default)
The content-type is in the comma separated list of mimeTypes set in the mimeTypes initParameter or if no mimeTypes are defined the content-type is not "application/gzip"
No content-encoding is specified by the resource
Мне кажется, что все эти условия соблюдены в моем случае, кроме возможно, последний: «Контент содержимого не указан ресурсом». Как я могу проверить это?
Плюс, по какой-либо причине я игнорирую, когда ответ не фильтруется с помощью GzipFilter, response.getWriter() выдает исключение IO. Почему это?