public void execute ( List < IntuitMessage > intuitMessages ) throws FMSException { LOG . debug ( "Enter HTTPBatchClientConnectionInterceptor - batch..." ) ; RequestElements intuitRequest = getFirst ( intuitMessages ) . getRequestElements ( ) ; IntuitRetryPolicyHandler handler = getRetryHandler ( ) ; HttpClientBuilder hcBuilder = HttpClients . custom ( ) . setRetryHandler ( handler ) . setDefaultRequestConfig ( setTimeout ( intuitRequest . getContext ( ) ) ) . setDefaultCredentialsProvider ( setProxyAuthentication ( ) ) . setSSLSocketFactory ( prepareClientSSL ( ) ) ; entitiesManager . reset ( ) ; HttpHost proxy = getProxy ( ) ; if ( proxy != null ) { hcBuilder . setProxy ( proxy ) ; } CloseableHttpClient client = hcBuilder . build ( ) ; HttpRequestBase httpRequest = prepareHttpRequest ( intuitRequest ) ; //Additional processing for POST requests if ( httpRequest instanceof HttpPost ) { for ( IntuitMessage intuitMessage : intuitMessages ) { execute ( intuitMessage ) ; } try { ( ( HttpPost ) httpRequest ) . setEntity ( entitiesManager . asSingleEntity ( ) ) ; } catch ( IOException ex ) { LOG . debug ( "HTTPBatchClientConnectionInterceptor was unable to convert input into single HTTP entity" ) ; throw new FMSException ( "Unable to prepare http entity" + ex . getMessage ( ) + "\n" + ex . getStackTrace ( ) ) ; } finally { entitiesManager . reset ( ) ; } } //Method to send request IntuitMessage intuitMessage = executeHttpRequest ( httpRequest , client ) ; //TODO review this implementation, since it is using one temporary instance to fill up response elements in original for ( IntuitMessage originalMessage : intuitMessages ) { ResponseElements originalResponseElements = originalMessage . getResponseElements ( ) ; ResponseElements receivedResponseElements = intuitMessage . getResponseElements ( ) ; originalResponseElements . setResponseContent ( receivedResponseElements . getResponseContent ( ) ) ; originalResponseElements . setEncodingHeader ( receivedResponseElements . getEncodingHeader ( ) ) ; originalResponseElements . setContentTypeHeader ( receivedResponseElements . getContentTypeHeader ( ) ) ; originalResponseElements . setStatusLine ( receivedResponseElements . getStatusLine ( ) ) ; originalResponseElements . setStatusCode ( receivedResponseElements . getStatusCode ( ) ) ; } LOG . debug ( "Exit HTTPBatchClientConnectionInterceptor." ) ; }
Major executor . It is not part of interface