Search in sources :

Example 56 with ContainerResponse

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

the class PathParamAsStringTest method testStringArgsPost.

@Test
public void testStringArgsPost() throws ExecutionException, InterruptedException {
    initiateWebApplication(Resource.class);
    final ContainerResponse response = apply(RequestContextBuilder.from("/a/b/c", "POST").entity("content").build());
    assertEquals("content", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 57 with ContainerResponse

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

the class PathParamDefaultValueTest method testParamInSubResource.

@Test
public void testParamInSubResource() throws ExecutionException, InterruptedException {
    initiateWebApplication(FooResource.class);
    ContainerResponse response = getResponseContext("/foo/baz/iddd");
    assertEquals(200, response.getStatus());
    assertEquals("iddd", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 58 with ContainerResponse

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

the class PathParamDefaultValueTest method testDefaultPathParamInSubResource.

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

Example 59 with ContainerResponse

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

the class PathParamDefaultValueTest method testDefaultPathParamValueOnResource1.

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

Example 60 with ContainerResponse

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

the class CookieParamAsPrimitiveTest method testBadPrimitiveListValue.

@Test
public void testBadPrimitiveListValue() throws ExecutionException, InterruptedException {
    final ContainerResponse responseContext = apply(RequestContextBuilder.from("/wrappers", "GET").accept("application/int").cookie(new Cookie("int", "abcdef")).build());
    assertEquals(400, responseContext.getStatus());
}
Also used : Cookie(javax.ws.rs.core.Cookie) 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