@Override protected HttpClientBuilder configureHttpClient(HttpClientBuilder builder) { return super.configureHttpClient(builder) .addInterceptorLast(new RequestResponseLogger()) .disableAutomaticRetries(); } };
httpClientBuilder.addInterceptorLast(new XsrfHttpRequestInterceptor());
builder.addInterceptorFirst(itcp); } else { builder.addInterceptorLast(itcp);
httpClientBuilder.addInterceptorLast(new HttpRequestInterceptor() { @Override public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
/** * Adds this protocol interceptor to the tail of the protocol processing list. * <p> * Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. */ final CustomHttpClientBuilder addInterceptorLast(final HttpRequestInterceptor itcp) { this.builder.addInterceptorLast(itcp); return this; }
/** * @param itcp * @return This object (for method chaining). * @see HttpClientBuilder#addInterceptorLast(HttpResponseInterceptor) */ public RestClientBuilder addInterceptorLast(HttpResponseInterceptor itcp) { httpClientBuilder.addInterceptorLast(itcp); return this; }
private HttpClientBuilder addInterceptors(HttpClientBuilder builder) { for (HttpRequestInterceptor interceptor : requestInterceptors) { builder.addInterceptorLast(interceptor); } for (HttpResponseInterceptor interceptor : responseInterceptor) { builder.addInterceptorLast(interceptor); } return builder; }
/** * Adds this protocol interceptor to the tail of the protocol processing list. * <p> * Please note this value can be overridden by the {@link #setHttpProcessor( * org.apache.http.protocol.HttpProcessor)} method. * </p> */ final CustomHttpClientBuilder addInterceptorLast(final HttpResponseInterceptor itcp) { this.builder.addInterceptorLast(itcp); return this; }
@Override protected HttpClientBuilder configureHttpClient(HttpClientBuilder builder) { builder.addInterceptorLast(requestInterceptor); return builder; }
/** * @param itcp * @return This object (for method chaining). * @see HttpClientBuilder#addInterceptorLast(HttpRequestInterceptor) */ public RestClientBuilder addInterceptorLast(HttpRequestInterceptor itcp) { httpClientBuilder.addInterceptorLast(itcp); return this; }
builder.addInterceptorFirst(itcp); } else { builder.addInterceptorLast(itcp);
/** * Adds handling of GZIP compression to the client. */ @Override public void enableCompression() { this.builder.addInterceptorLast(new RequestAcceptEncoding()); this.builder.addInterceptorLast(new ResponseContentEncoding()); this.client = this.builder.build(); }
@Override public TClient withResponseFilterLast( ServiceResponseFilter serviceResponseFilter) { httpClientBuilder .addInterceptorLast(new HttpResponseInterceptorAdapter( serviceResponseFilter)); return this.newInstance(httpClientBuilder, executorService); }
@Override public TClient withRequestFilterLast( ServiceRequestFilter serviceRequestFilter) { httpClientBuilder.addInterceptorLast(new HttpRequestInterceptorAdapter( serviceRequestFilter)); return this.newInstance(httpClientBuilder, executorService); }
@Override public HttpClientBuilder extend(HttpClientBuilder httpClientBuilder, GerritAuthData authData) { HttpClientBuilder builder = super.extend(httpClientBuilder, authData); httpClientBuilder.addInterceptorLast(new UserAgentHttpRequestInterceptor()); return builder; }
@Override public TClient withRequestFilterLast( ServiceRequestFilter serviceRequestFilter) { if (httpRequestInterceptorBackAdapter == null) { httpRequestInterceptorBackAdapter = new HttpRequestInterceptorBackAdapter(); httpClientBuilder.addInterceptorLast(httpRequestInterceptorBackAdapter); } httpRequestInterceptorBackAdapter.addBack(serviceRequestFilter); return this.newInstance(httpClientBuilder, executorService); }
@Override public B2ApiClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); configuration.setServiceUnavailableRetryStrategy(retryHandler = new B2ErrorResponseInterceptor( this)); configuration.addInterceptorLast(retryHandler); return new B2ApiClient(configuration.build()); }
@Override protected HttpClientBuilder configureHttpClient(HttpClientBuilder builder) { return super.configureHttpClient(builder) .addInterceptorLast(new RequestResponseLogger()) .disableAutomaticRetries(); } };
@Override public Client connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { authorizationService = new OAuth2RequestInterceptor(builder.build(proxy, this, prompt).build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); final HttpClientBuilder configuration = builder.build(proxy, this, prompt); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(authorizationService)); return new Client(configuration.build()); }
@Override public RequestEntityRestStorageService connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) { authorizationService = new OAuth2RequestInterceptor(builder.build(proxy, this, prompt).build(), host.getProtocol()) .withRedirectUri(host.getProtocol().getOAuthRedirectUrl()); final HttpClientBuilder configuration = builder.build(proxy, this, prompt); configuration.addInterceptorLast(authorizationService); configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(authorizationService)); return new OAuth2RequestEntityRestStorageService(this, this.configure(), configuration); }