use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class DynamicFeatureTest method testPreMatchingFilter.
@Test
public void testPreMatchingFilter() throws Exception {
final ApplicationHandler application = createApplication(PreMatchingDynamicFeature.class);
ContainerResponse response;
response = application.apply(RequestContextBuilder.from("/resource/postmatch", "GET").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get", response.getEntity());
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class DynamicFeatureTest method testSupportedProvidersFeature.
@Test
public void testSupportedProvidersFeature() throws Exception {
final ApplicationHandler application = createApplication(SupportedProvidersDynamicFeature.class);
ContainerResponse response;
response = application.apply(RequestContextBuilder.from("/resource/providers", "POST").entity("get").build()).get();
assertEquals(200, response.getStatus());
assertEquals("get", response.getEntity());
assertEquals("ProviderBall", response.getHeaderString("writer"));
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class HeadSubResourceMethodTest method testGetWithProduceWithHead.
@Test
public void testGetWithProduceWithHead() throws Exception {
initiateWebApplication(ResourceGetWithProduceWithHead.class);
MediaType foo = MediaType.valueOf("application/foo");
ContainerResponse response = app.apply(RequestContextBuilder.from("/sub", "HEAD").accept(foo).build()).get();
assertEquals(200, response.getStatus());
assertFalse(response.hasEntity());
assertEquals(foo, response.getMediaType());
assertEquals("FOO-HEAD", response.getHeaders().getFirst("X-TEST").toString());
MediaType bar = MediaType.valueOf("application/bar");
response = app.apply(RequestContextBuilder.from("/sub", "HEAD").accept(bar).build()).get();
assertEquals(200, response.getStatus());
assertFalse(response.hasEntity());
assertEquals(bar, response.getMediaType());
assertEquals("BAR-HEAD", response.getHeaders().getFirst("X-TEST").toString());
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class HeadSubResourceMethodTest method testGetWithProduceNoHeadDifferentSub.
@Test
public void testGetWithProduceNoHeadDifferentSub() throws Exception {
initiateWebApplication(ResourceGetWithProduceNoHeadDifferentSub.class);
MediaType foo = MediaType.valueOf("application/foo");
ContainerResponse response = app.apply(RequestContextBuilder.from("/sub1", "HEAD").accept(foo).build()).get();
assertEquals(200, response.getStatus());
assertFalse(response.hasEntity());
assertEquals(foo, response.getMediaType());
MediaType bar = MediaType.valueOf("application/bar");
response = app.apply(RequestContextBuilder.from("/sub2", "HEAD").accept(bar).build()).get();
assertEquals(200, response.getStatus());
assertFalse(response.hasEntity());
assertEquals(bar, response.getMediaType());
}
use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.
the class HeadTest method testResourceXXX.
@Test
public void testResourceXXX() throws Exception {
initiateWebApplication(ResourceGetWithNoProduces.class);
ContainerResponse response = app.apply(RequestContextBuilder.from("/", "HEAD").accept("text/plain").build()).get();
assertEquals(200, response.getStatus());
assertEquals("text", response.getHeaderString("x-value"));
response = app.apply(RequestContextBuilder.from("/", "HEAD").accept("text/html").build()).get();
assertEquals(200, response.getStatus());
assertEquals("html", response.getHeaderString("x-value"));
}
Aggregations