List of usage examples for org.apache.http.conn.params ConnRouteParamBean ConnRouteParamBean
public ConnRouteParamBean(final HttpParams params)
From source file:com.alu.e3.gateway.loadbalancer.E3HttpClientConfigurer.java
/** * Sets global PROXY for HttpClient//from ww w. j a v a2s. co m * @param client HttpClient * @param params of the PROXY */ private void setForwardProxy(HttpClient client, HttpParams params) { if (forwardProxy != null) { if (client instanceof DefaultHttpClient) { String host = forwardProxy.getProxyHost(); Integer port = new Integer(forwardProxy.getProxyPort()); if (host != null && port != null) { HttpHost httpHost = new HttpHost(host, port); ConnRouteParamBean connRouteParamBean = new ConnRouteParamBean(params); connRouteParamBean.setDefaultProxy(httpHost); String user = forwardProxy.getProxyUser(); String pass = forwardProxy.getProxyPass(); if (user != null && pass != null) { Credentials credentials = null; String ntdomain = null; //targetHost.getForwardProxy().getProxyNtDomain; String ntworkstation = null; //targetHost.getForwardProxy().getProxyNtWorkstation(); if (ntdomain != null || ntworkstation != null) { credentials = new NTCredentials(user, pass, ntworkstation, ntdomain); } else { credentials = new UsernamePasswordCredentials(user, pass); } AuthScope authscope = new AuthScope(host, port); DefaultHttpClient defaultHttpClient = (DefaultHttpClient) client; defaultHttpClient.getCredentialsProvider().setCredentials(authscope, credentials); } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug("The proxy is set with no user or password information"); } } } else { LOGGER.error("Unable to set proxy settings: Host or Port are NULL"); } } else { LOGGER.error("Unable to set proxy settings: Unsupported HttpClient implementation"); } } }
From source file:org.apache.camel.component.http4.HttpComponent.java
protected HttpParams configureHttpParams(Map<String, Object> parameters) throws Exception { HttpParams clientParams = new BasicHttpParams(); AuthParamBean authParamBean = new AuthParamBean(clientParams); IntrospectionSupport.setProperties(authParamBean, parameters, "httpClient."); ClientParamBean clientParamBean = new ClientParamBean(clientParams); IntrospectionSupport.setProperties(clientParamBean, parameters, "httpClient."); ConnConnectionParamBean connConnectionParamBean = new ConnConnectionParamBean(clientParams); IntrospectionSupport.setProperties(connConnectionParamBean, parameters, "httpClient."); ConnManagerParamBean connManagerParamBean = new ConnManagerParamBean(clientParams); IntrospectionSupport.setProperties(connManagerParamBean, parameters, "httpClient."); ConnRouteParamBean connRouteParamBean = new ConnRouteParamBean(clientParams); IntrospectionSupport.setProperties(connRouteParamBean, parameters, "httpClient."); CookieSpecParamBean cookieSpecParamBean = new CookieSpecParamBean(clientParams); IntrospectionSupport.setProperties(cookieSpecParamBean, parameters, "httpClient."); HttpConnectionParamBean httpConnectionParamBean = new HttpConnectionParamBean(clientParams); IntrospectionSupport.setProperties(httpConnectionParamBean, parameters, "httpClient."); HttpProtocolParamBean httpProtocolParamBean = new HttpProtocolParamBean(clientParams); IntrospectionSupport.setProperties(httpProtocolParamBean, parameters, "httpClient."); return clientParams; }