/** * Sets the default Properties File and Heading, and creates the HttpClient and connection * manager. * <p> * @param remoteHttpCacheAttributes */ public AbstractHttpClient( RemoteHttpCacheAttributes remoteHttpCacheAttributes ) { setRemoteHttpCacheAttributes( remoteHttpCacheAttributes ); setConnectionManager( new MultiThreadedHttpConnectionManager() ); // THIS IS NOT THREAD SAFE: // setHttpClient( new HttpClient() ); // THIS IS: setHttpClient( new HttpClient( getConnectionManager() ) ); configureClient(); }
/** * Extracted method that can be overwritten to do additional things to the post before the call * is made. * <p> * @param post the post that is about to get executed. * @throws IOException on i/o error */ protected final void doWebserviceCall( HttpMethod post ) throws IOException { HttpState httpState = preProcessWebserviceCall( post ); getHttpClient().executeMethod( null, post, httpState ); postProcessWebserviceCall( post, httpState ); }
/** * Extracted method that can be overwritten to do additional things to the post before the call * is made. * <p> * @param post the post that is about to get executed. * @throws IOException on i/o error */ protected final void doWebserviceCall( HttpMethod post ) throws IOException { HttpState httpState = preProcessWebserviceCall( post ); this.httpClient.executeMethod( null, post, httpState ); postProcessWebserviceCall( post, httpState ); }
if ( getRemoteHttpCacheAttributes().getMaxConnectionsPerHost() > 0 ) getConnectionManager().getParams().setMaxTotalConnections( getRemoteHttpCacheAttributes() .getMaxConnectionsPerHost() ); getConnectionManager().getParams().setSoTimeout( getRemoteHttpCacheAttributes().getSocketTimeoutMillis() ); String httpVersion = getRemoteHttpCacheAttributes().getHttpVersion(); if ( httpVersion != null ) getHttpClient().getParams().setParameter( "http.protocol.version", HttpVersion.HTTP_1_1 ); getHttpClient().getParams().setParameter( "http.protocol.version", HttpVersion.HTTP_1_0 ); getConnectionManager().getParams().setConnectionTimeout( getRemoteHttpCacheAttributes() .getConnectionTimeoutMillis() ); getHttpClient().getParams().setCookiePolicy( cookiePolicy );
/** * Sets the default Properties File and Heading, and creates the HttpClient and connection * manager. * <p> * @param remoteHttpCacheAttributes */ public AbstractHttpClient( RemoteHttpCacheAttributes remoteHttpCacheAttributes ) { this.remoteHttpCacheAttributes = remoteHttpCacheAttributes; this.connectionManager = new MultiThreadedHttpConnectionManager(); this.httpClient = new HttpClient(this.connectionManager); configureClient(); }
if ( getRemoteHttpCacheAttributes().getMaxConnectionsPerHost() > 0 ) .setMaxTotalConnections(getRemoteHttpCacheAttributes().getMaxConnectionsPerHost()); this.connectionManager.getParams() .setDefaultMaxConnectionsPerHost(getRemoteHttpCacheAttributes().getMaxConnectionsPerHost()); this.connectionManager.getParams().setSoTimeout( getRemoteHttpCacheAttributes().getSocketTimeoutMillis() ); String httpVersion = getRemoteHttpCacheAttributes().getHttpVersion(); if ( httpVersion != null ) .setConnectionTimeout(getRemoteHttpCacheAttributes().getConnectionTimeoutMillis());