use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class EncodingFilterTest method initializeAndGetFilter.
@SuppressWarnings("unchecked")
private EncodingFilter initializeAndGetFilter() {
ResourceConfig rc = new ResourceConfig();
EncodingFilter.enableFor(rc, FooEncoding.class, GZipEncoder.class);
return (EncodingFilter) new ApplicationHandler(rc).getInjectionManager().getInstance(ContainerResponseFilter.class);
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class EntityTypeFilterTest method test.
@Test
public void test() throws ExecutionException, InterruptedException {
ApplicationHandler handler = new ApplicationHandler(new ResourceConfig(Resource.class, ResponseFilter.class));
final ContainerResponse response = handler.apply(RequestContextBuilder.from("/resource/getentitytype", "GET").build()).get();
assertEquals(200, response.getStatus());
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class FilterSetMethodTest method testResource.
@Test
public void testResource() throws ExecutionException, InterruptedException {
ApplicationHandler handler = new ApplicationHandler(new ResourceConfig(Resource.class, PostMatchFilter.class));
ContainerResponse res = handler.apply(RequestContextBuilder.from("", "/resource/setMethodInResource", "GET").build()).get();
assertEquals(200, res.getStatus());
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class FilterSetMethodTest method testPreMatchingFilter.
@Test
public void testPreMatchingFilter() throws ExecutionException, InterruptedException {
ApplicationHandler handler = new ApplicationHandler(new ResourceConfig(Resource.class, PreMatchFilter.class));
ContainerResponse res = handler.apply(RequestContextBuilder.from("", "/resource/setMethod", "GET").build()).get();
assertEquals(200, res.getStatus());
}
use of org.glassfish.jersey.server.ApplicationHandler in project jersey by jersey.
the class PropertyValidationTest method assertApply.
private void assertApply(int responseStatus, ResourceConfig resourceConfig, URI uri) throws InterruptedException, ExecutionException {
final ApplicationHandler applicationHandler = new ApplicationHandler(resourceConfig);
final ContainerRequest requestContext = new ContainerRequest(uri, uri, "POST", null, new MapPropertiesDelegate());
final ContainerResponse containerResponse = applicationHandler.apply(requestContext).get();
assertEquals(responseStatus, containerResponse.getStatus());
}
Aggregations