Java Reference
In-Depth Information
}
}
To bind the interceptor to a particular client, we will use the register method of the
Client object. The following code demonstrates how to associate an interceptor or
a filter to a JAX-RS Client:
public static void main(String[] args) throws
IOException {
String baseURI = "http://localhost:8080/
chapter06EISintegration-web";
String location = "/rs-resources";
String method = "/students/
getListOfAllStudentsGzip";
//client creation and registration of the
interceptor/filter
Client client =
ClientBuilder.newClient().register(MyGzipReaderJaxRsInterceptor.class);
WebTarget target =
(WebTarget)client.target(baseURI + location +
method);
System.out.println("response : " +
target.request(MediaType.APPLICATION_JSON).get(String.class));
}
Search WWH ::




Custom Search