Search in sources :

Example 11 with ContainerResponse

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

the class ChildResourceTest method testAnotherChildResource.

@Test
public void testAnotherChildResource() throws ExecutionException, InterruptedException {
    ApplicationHandler applicationHandler = createApplication();
    final ContainerResponse response = applicationHandler.apply(RequestContextBuilder.from("/root/another-child", "GET").build()).get();
    assertEquals(200, response.getStatus());
    assertEquals("another-child-get", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) Test(org.junit.Test)

Example 12 with ContainerResponse

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

the class ResourceNotFoundTest method testExistingMixedResources.

@Test
public void testExistingMixedResources() throws Exception {
    ApplicationHandler app = createMixedApp();
    ContainerResponse response;
    response = app.apply(RequestContextBuilder.from("/foo", "GET").accept("text/plain").build()).get();
    assertEquals(200, response.getStatus());
    assertEquals("foo", response.getEntity());
    response = app.apply(RequestContextBuilder.from("/dynamic", "GET").accept("text/plain").build()).get();
    assertEquals(200, response.getStatus());
    assertEquals("dynamic", response.getEntity());
    response = app.apply(RequestContextBuilder.from("/foo/bar", "GET").accept("text/plain").build()).get();
    assertEquals(200, response.getStatus());
    assertEquals("bar", response.getEntity());
    response = app.apply(RequestContextBuilder.from("/foo/dynamic", "GET").accept("text/plain").build()).get();
    assertEquals(200, response.getStatus());
    assertEquals("dynamic", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) Test(org.junit.Test)

Example 13 with ContainerResponse

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

the class SubResourceDynamicTest method testSubResourceDynamic.

@Test
public void testSubResourceDynamic() throws Exception {
    app = createApplication(Parent.class);
    ContainerResponse response;
    response = app.apply(RequestContextBuilder.from("/parent", "GET").accept("text/plain").build()).get();
    assertEquals("parent", response.getEntity());
    response = app.apply(RequestContextBuilder.from("/parent/child", "GET").accept("text/plain").build()).get();
    assertEquals("child", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 14 with ContainerResponse

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

the class ExtendedUriInfoTest method testResourceMethod.

@Test
public void testResourceMethod() throws ExecutionException, InterruptedException {
    final ApplicationHandler applicationHandler = getApplication();
    final ContainerResponse response = applicationHandler.apply(RequestContextBuilder.from("/root", "GET").build()).get();
    assertEquals("root", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) Test(org.junit.Test)

Example 15 with ContainerResponse

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

the class ExtendedUriInfoTest method testChildResourceMethod.

@Test
public void testChildResourceMethod() throws ExecutionException, InterruptedException {
    final ApplicationHandler applicationHandler = getApplication();
    final ContainerResponse response = applicationHandler.apply(RequestContextBuilder.from("/root/child", "GET").build()).get();
    assertEquals("child", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ApplicationHandler(org.glassfish.jersey.server.ApplicationHandler) 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