Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.mc.printer.model.layout.ws; import org.apache.http.client.HttpClient; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; /** * * @author 305027939 */ public class ComHttpComponentsClientHttpRequestFactory extends HttpComponentsClientHttpRequestFactory { public ComHttpComponentsClientHttpRequestFactory(HttpClient httpClient) { super(httpClient); } // @Override // protected HttpContext createHttpContext(HttpMethod httpMethod, URI uri) { // return createHttpContext(); // } // // private HttpContext createHttpContext() { // HttpHost host = new HttpHost(Constants.SERVICE_PORT,Integer.parseInt(Constants.SERVICE_PORT)); //// Create AuthCache instance // AuthCache authCache = new BasicAuthCache(); //// Generate BASIC scheme object and add it to the local auth cache // BasicScheme basicAuth = new BasicScheme(Charset.forName("UTF-8")); // authCache.put(host, basicAuth); // // Add AuthCache to the execution context // BasicHttpContext localcontext = new BasicHttpContext(); // localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache); // return localcontext; // } }