Search in sources :

Example 86 with ContainerResponse

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

the class PathParamDefaultValueTest method testDefaultPathParamValueOnResource2.

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

Example 87 with ContainerResponse

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

the class QueryParamAsPrimitiveTest method testBadPrimitiveValue.

@Test
public void testBadPrimitiveValue() throws ExecutionException, InterruptedException {
    final ContainerResponse response = super.getResponseContext("/?int=abcdef", "application/int");
    assertEquals(404, response.getStatus());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 88 with ContainerResponse

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

the class QueryParamAsPrimitiveTest method testBadPrimitiveWrapperValue.

@Test
public void testBadPrimitiveWrapperValue() throws ExecutionException, InterruptedException {
    final ContainerResponse response = super.getResponseContext("/wrappers?int=abcdef", "application/int");
    assertEquals(404, response.getStatus());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 89 with ContainerResponse

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

the class QueryParamAsPrimitiveTest method _testDefault.

void _testDefault(String base, String type, String value) throws ExecutionException, InterruptedException {
    ContainerResponse get = apply(RequestContextBuilder.from(base + "default/null", "GET").accept("application/" + type).build());
    System.out.println("### " + get.getStatus());
    assertEquals("content", get.getEntity());
    assertEquals("content", apply(RequestContextBuilder.from(base + "default", "GET").accept("application/" + type).build()).getEntity());
    String param = type + "=" + value;
    assertEquals("content", apply(RequestContextBuilder.from(base + "default/override?" + param, "GET").accept("application/" + type).build()).getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse)

Example 90 with ContainerResponse

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

the class QueryParamAsSetPrimitiveTest method testBadPrimitiveSetValue.

@Test
public void testBadPrimitiveSetValue() throws ExecutionException, InterruptedException {
    final ContainerResponse response = super.getResponseContext("/Set?int=abcdef&int=abcdef", "application/int");
    assertEquals(404, response.getStatus());
}
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