Hello,
I have the "com.sun.jersey.api.container.MappableContainerException: java.io.EOFException: Unexpected end of ZLIB input stream" error when using client/server GZIPContentEncodingFilter. And everything is working fine when these filters are removed from the configuration.
Here is my part of the server web.xml:
<servlet>
<servlet-name>esWebServices</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.GZIPContentEncodingFilter</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.feature.Redirect</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.feature.ImplicitViewables</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
My client config:
private Client initClient() {
ClientConfig clientConfig = new DefaultApacheHttpClientConfig();
clientConfig.getProperties().put(ApacheHttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION, false);
clientConfig.getProperties().put(ApacheHttpClientConfig.PROPERTY_CHUNKED_ENCODING_SIZE, 0);
clientConfig.getProperties().put(ApacheHttpClientConfig.PROPERTY_CREDENTIALS_PROVIDER,
new DefaultCredentialsProvider(realm));
clientConfig.getProperties().put(ApacheHttpClientConfig.PROPERTY_INTERACTIVE, false);
int readTimeOut = GeneralPreferences.getInstance().getServerReadTimeout();
if (readTimeOut > 0) {
clientConfig.getProperties().put(ApacheHttpClientConfig.PROPERTY_READ_TIMEOUT, readTimeOut);
}
int connectTimeOut = GeneralPreferences.getInstance().getServerConnectionTimeout();
if (connectTimeOut > 0) {
clientConfig.getProperties().put(ApacheHttpClientConfig.PROPERTY_CONNECT_TIMEOUT, connectTimeOut);
}
httpState = new HttpState();
clientConfig.getProperties().put(ApacheHttpClientConfig.PROPERTY_HTTP_STATE,
new ApacheHttpClientState(httpState));
clientConfig.getProperties().put(ApacheHttpClientConfig.PROPERTY_HANDLE_COOKIES, true);
Protocol easyHttps = new Protocol(HTTPS_SCHEMA, (ProtocolSocketFactory) new EasySSLProtocolSocketFactory(),
defaultSslPort);
Protocol.registerProtocol(HTTPS_SCHEMA, easyHttps);
ApacheHttpClient apaheClient = ApacheHttpClient.create(clientConfig);
apaheClient.addFilter(new GZIPContentEncodingFilter());
return apaheClient;
}
And client code which makes call to the server:
UserAuthenticationDto usrAuth = new UserAuthenticationDto();
usrAuth.setUser("Test User");
return webResource.path("helloto.ws").accept("application/json").put(String.class, usrAuth);
Is it jersey bug? Or maybe something wrong with my config?
Best Regards,
Sergey