protected HttpClientWrapper() { m_cookieStore = new BasicCookieStore(); // According to the HTTP specification, adding the default ports to the host header is optional. // If the default ports are added, several Web Servers like Microsoft IIS 7.5 will complain about it, and could lead to unwanted results. addRequestInterceptor(new HttpRequestInterceptor() { @Override public void process(HttpRequest request, HttpContext context) throws HttpException, IOException { Header host = request.getFirstHeader(HTTP.TARGET_HOST); if (host != null) { if (host.getValue().endsWith(":80") || host.getValue().endsWith(":443")) { request.setHeader(HTTP.TARGET_HOST, host.getValue().replaceFirst(":\\d+", "")); LOG.info("httpRequestInterceptor: removing default port from host header"); } } } }); }
m_clientWrapper.addRequestInterceptor(new RequestAcceptEncoding()) .addResponseInterceptor(new ResponseContentEncoding());
m_clientWrapper.addRequestInterceptor(new RequestAcceptEncoding()) .addResponseInterceptor(new ResponseContentEncoding());
clientWrapper.addRequestInterceptor(new HttpRequestInterceptor() { @Override public void process(HttpRequest request, HttpContext ctx) throws HttpException, IOException {