use of org.apache.http.HttpRequestInterceptor in project camel by apache.
the class HttpsAuthenticationTest method getBasicHttpProcessor.
@Override
protected HttpProcessor getBasicHttpProcessor() {
List<HttpRequestInterceptor> requestInterceptors = new ArrayList<HttpRequestInterceptor>();
requestInterceptors.add(new RequestBasicAuth());
List<HttpResponseInterceptor> responseInterceptors = new ArrayList<HttpResponseInterceptor>();
responseInterceptors.add(new ResponseContent());
responseInterceptors.add(new ResponseBasicUnauthorized());
ImmutableHttpProcessor httpproc = new ImmutableHttpProcessor(requestInterceptors, responseInterceptors);
return httpproc;
}
use of org.apache.http.HttpRequestInterceptor in project brave by openzipkin.
the class ITTracingHttpAsyncClientBuilder method currentSpanVisibleToUserFilters.
@Test
public void currentSpanVisibleToUserFilters() throws Exception {
server.enqueue(new MockResponse());
closeClient(client);
client = TracingHttpAsyncClientBuilder.create(httpTracing).addInterceptorLast((HttpRequestInterceptor) (request, context) -> request.setHeader("my-id", currentTraceContext.get().traceIdString())).build();
client.start();
get(client, "/foo");
RecordedRequest request = server.takeRequest();
assertThat(request.getHeader("x-b3-traceId")).isEqualTo(request.getHeader("my-id"));
takeSpan();
}
use of org.apache.http.HttpRequestInterceptor in project brave by openzipkin.
the class ITTracingHttpClientBuilder method currentSpanVisibleToUserFilters.
@Test
public void currentSpanVisibleToUserFilters() throws Exception {
server.enqueue(new MockResponse());
closeClient(client);
client = TracingHttpClientBuilder.create(httpTracing).disableAutomaticRetries().addInterceptorFirst((HttpRequestInterceptor) (request, context) -> request.setHeader("my-id", currentTraceContext.get().traceIdString())).build();
get(client, "/foo");
RecordedRequest request = server.takeRequest();
assertThat(request.getHeader("x-b3-traceId")).isEqualTo(request.getHeader("my-id"));
takeSpan();
}
use of org.apache.http.HttpRequestInterceptor in project camel by apache.
the class HttpCompressionTest method getBasicHttpProcessor.
@Override
protected HttpProcessor getBasicHttpProcessor() {
List<HttpRequestInterceptor> requestInterceptors = new ArrayList<HttpRequestInterceptor>();
requestInterceptors.add(new RequestDecompressingInterceptor());
List<HttpResponseInterceptor> responseInterceptors = new ArrayList<HttpResponseInterceptor>();
responseInterceptors.add(new ResponseCompressingInterceptor());
responseInterceptors.add(new ResponseBasicUnauthorized());
ImmutableHttpProcessor httpproc = new ImmutableHttpProcessor(requestInterceptors, responseInterceptors);
return httpproc;
}
use of org.apache.http.HttpRequestInterceptor in project camel by apache.
the class HttpAuthenticationTest method getBasicHttpProcessor.
@Override
protected HttpProcessor getBasicHttpProcessor() {
List<HttpRequestInterceptor> requestInterceptors = new ArrayList<HttpRequestInterceptor>();
requestInterceptors.add(new RequestBasicAuth());
List<HttpResponseInterceptor> responseInterceptors = new ArrayList<HttpResponseInterceptor>();
responseInterceptors.add(new ResponseContent());
responseInterceptors.add(new ResponseBasicUnauthorized());
ImmutableHttpProcessor httpproc = new ImmutableHttpProcessor(requestInterceptors, responseInterceptors);
return httpproc;
}
Aggregations