use of demo.jaxrs.tracing.server.CatalogTracing in project cxf by apache.
the class ApacheHttpClient method main.
public static void main(final String[] args) throws Exception {
try (final CatalogTracing tracing = new CatalogTracing("catalog-client")) {
final CloseableHttpClient httpclient = TracingHttpClientBuilder.create(tracing.getHttpTracing()).build();
final HttpGet request = new HttpGet("http://localhost:9000/catalog");
request.setHeader("Accept", "application/json");
final HttpResponse response = httpclient.execute(request);
System.out.println(EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8));
httpclient.close();
}
}
use of demo.jaxrs.tracing.server.CatalogTracing in project cxf by apache.
the class ApacheHttpAsyncClient method main.
public static void main(final String[] args) throws Exception {
try (final CatalogTracing tracing = new CatalogTracing("catalog-client")) {
final CloseableHttpAsyncClient httpclient = TracingHttpAsyncClientBuilder.create(tracing.getHttpTracing()).build();
final HttpGet request = new HttpGet("http://localhost:9000/catalog");
request.setHeader("Accept", "application/json");
httpclient.start();
final Future<HttpResponse> response = httpclient.execute(request, new FutureCallback<HttpResponse>() {
@Override
public void completed(HttpResponse result) {
try {
System.out.println(EntityUtils.toString(result.getEntity(), StandardCharsets.UTF_8));
} catch (final IOException ex) {
System.out.println(ex);
}
}
@Override
public void failed(Exception ex) {
System.out.println(ex);
}
@Override
public void cancelled() {
}
});
response.get(1000, TimeUnit.MILLISECONDS);
httpclient.close();
}
}
use of demo.jaxrs.tracing.server.CatalogTracing in project cxf by apache.
the class OkHttp3Client method main.
public static void main(final String[] args) throws Exception {
try (final CatalogTracing tracing = new CatalogTracing("catalog-client")) {
final OkHttpClient client = new OkHttpClient();
final Call.Factory factory = TracingCallFactory.create(tracing.getHttpTracing(), client);
final Request request = new Request.Builder().url("http://localhost:9000/catalog").header("Accept", "application/json").build();
try (final Response response = factory.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}
Aggregations