use of org.glassfish.jersey.client.JerseyWebTarget in project jersey by jersey.
the class ClientPreInitTest method testReusingPreinitializedConfig.
@Test
public void testReusingPreinitializedConfig() {
Client client = ClientBuilder.newClient();
client.register(TestReader.class);
final WebTarget target = client.target(super.getBaseUri()).path("resource");
target.register(MyResponseFilter.class);
((JerseyWebTarget) target).preInitialize();
assertTrue(TestReader.initialized);
final WebTarget childTarget = target.path("child");
final Response response = childTarget.request().get();
checkResponse(response, "child:<null>");
final Response resourceResponse = target.request().get();
checkResponse(resourceResponse, "resource:<null>");
}
use of org.glassfish.jersey.client.JerseyWebTarget in project jersey by jersey.
the class ClientPreInitTest method testRegisterOnPreinitialized1.
@Test
public void testRegisterOnPreinitialized1() {
Client client = ClientBuilder.newClient();
final WebTarget target = client.target(super.getBaseUri()).path("resource");
target.register(MyRequestFilter.class);
((JerseyWebTarget) target).preInitialize();
target.register(MyResponseFilter.class);
final Response response = target.request().get();
checkResponse(response, "resource:called");
}
use of org.glassfish.jersey.client.JerseyWebTarget in project jersey by jersey.
the class ClientPreInitTest method testRegisterOnPreinitialized2.
@Test
public void testRegisterOnPreinitialized2() {
Client client = ClientBuilder.newClient();
final WebTarget target = client.target(super.getBaseUri()).path("resource");
target.register(MyResponseFilter.class);
((JerseyWebTarget) target).preInitialize();
final WebTarget child = target.path("child");
child.register(MyRequestFilter.class);
final Response response = target.request().get();
checkResponse(response, "resource:<null>");
final Response childResponse = child.request().get();
checkResponse(childResponse, "child:called");
}
use of org.glassfish.jersey.client.JerseyWebTarget in project jersey by jersey.
the class ClientPreInitTest method testSimplePreinitialize.
@Test
public void testSimplePreinitialize() {
Client client = ClientBuilder.newClient();
final WebTarget target = client.target(super.getBaseUri()).path("resource");
target.register(MyResponseFilter.class);
final WebTarget childTarget = target.path("child");
((JerseyWebTarget) childTarget).preInitialize();
final Response response = childTarget.request().get();
checkResponse(response, "child:<null>");
final Response resourceResponse = target.request().get();
checkResponse(resourceResponse, "resource:<null>");
}
Aggregations