Search in sources :

Example 81 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse 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());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ContainerResponseFilter(javax.ws.rs.container.ContainerResponseFilter) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) Test(org.junit.Test)

Example 82 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse 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());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) Test(org.junit.Test)

Example 83 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse 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());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) Test(org.junit.Test)

Example 84 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.

the class PathParamDefaultValueTest method testCallWithMissingPathParam404.

@Test
public void testCallWithMissingPathParam404() throws ExecutionException, InterruptedException {
    initiateWebApplication(Resource.class);
    ContainerResponse response = getResponseContext("/foo/bar");
    assertEquals(404, response.getStatus());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 85 with ContainerResponse

use of org.glassfish.jersey.server.ContainerResponse in project jersey by jersey.

the class PathParamDefaultValueTest method testDefaultPathParamValueFoo.

@Test
public void testDefaultPathParamValueFoo() throws ExecutionException, InterruptedException {
    initiateWebApplication(FooResource.class);
    ContainerResponse response = getResponseContext("/foo");
    assertEquals("default-id", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Aggregations

ContainerResponse (org.glassfish.jersey.server.ContainerResponse)211 Test (org.junit.Test)190 ApplicationHandler (org.glassfish.jersey.server.ApplicationHandler)95 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)58 MediaType (javax.ws.rs.core.MediaType)16 Form (javax.ws.rs.core.Form)14 ContainerRequest (org.glassfish.jersey.server.ContainerRequest)14 Cookie (javax.ws.rs.core.Cookie)7 Response (javax.ws.rs.core.Response)5 Ignore (org.junit.Ignore)4 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 ContainerRequestContext (javax.ws.rs.container.ContainerRequestContext)2 ContainerResponseFilter (javax.ws.rs.container.ContainerResponseFilter)2 ContainerException (org.glassfish.jersey.server.ContainerException)2 RequestContextBuilder (org.glassfish.jersey.server.RequestContextBuilder)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 URI (java.net.URI)1 HashSet (java.util.HashSet)1