Sumalatha Vanka
2014-04-22 18:07:03 UTC
Hi,
I am seeing jersey 2.7 client is not handling the redirects for post requests by default.
This is how I am creating the jersey client with 2.7 version.
ClientConfig cc = new ClientConfig();
Client jerseyClient;
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
cm.setMaxTotal(config.getMaxConnectionsTotal().intValue());
cm.setDefaultMaxPerRoute(config.getMaxConnectionsPerService().intValue());
cc.property(ApacheClientProperties.CONNECTION_MANAGER, cm);
cc.property(ClientProperties.CONNECT_TIMEOUT, (int) config.getConnectionTimeOut().toMillis());
ApacheConnectorProvider connector = new ApacheConnectorProvider();
cc.connectorProvider(connector);
jerseyClient = ClientBuilder.newBuilder().withConfig(cc).build();
jerseyClient.register(JacksonFeature.class);
Above code is not handling the 307 redirects for http post calls.
Couple of questions
1. is there a way to pass the instance of HttpClient to Jersey client, like in 1.x?
2. How to fix 307 redirects for http post calls?
Thanks,
Suma
I am seeing jersey 2.7 client is not handling the redirects for post requests by default.
This is how I am creating the jersey client with 2.7 version.
ClientConfig cc = new ClientConfig();
Client jerseyClient;
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
cm.setMaxTotal(config.getMaxConnectionsTotal().intValue());
cm.setDefaultMaxPerRoute(config.getMaxConnectionsPerService().intValue());
cc.property(ApacheClientProperties.CONNECTION_MANAGER, cm);
cc.property(ClientProperties.CONNECT_TIMEOUT, (int) config.getConnectionTimeOut().toMillis());
ApacheConnectorProvider connector = new ApacheConnectorProvider();
cc.connectorProvider(connector);
jerseyClient = ClientBuilder.newBuilder().withConfig(cc).build();
jerseyClient.register(JacksonFeature.class);
Above code is not handling the 307 redirects for http post calls.
Couple of questions
1. is there a way to pass the instance of HttpClient to Jersey client, like in 1.x?
2. How to fix 307 redirects for http post calls?
Thanks,
Suma