Search in sources :

Example 61 with ContainerResponse

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

the class QueryParamStringConstructorTest method testBadStringConstructorValue.

@Test
public void testBadStringConstructorValue() throws ExecutionException, InterruptedException {
    initiateWebApplication(ResourceString.class);
    final ContainerResponse responseContext = getResponseContext("/?arg1=ABCDEF&arg2=3145&arg3=http:%2F%2Ftest");
    assertEquals(404, responseContext.getStatus());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 62 with ContainerResponse

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

the class UriTest method testResolveTemplateInFieldManagedClient.

@Test
public void testResolveTemplateInFieldManagedClient() throws Exception {
    initiateWebApplication(Resource5.class);
    final ContainerResponse response = apply(RequestContextBuilder.from("/test/1", "GET").build());
    assertThat(response.getEntity().toString(), equalTo("http://oracle.com/foo"));
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 63 with ContainerResponse

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

the class UriTest method testGetRelative2.

@Test
public void testGetRelative2() throws ExecutionException, InterruptedException {
    initiateWebApplication(Resource3.class);
    final ContainerResponse response = apply(RequestContextBuilder.from("/test/parameter", "GET").build());
    assertEquals("/parameter", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 64 with ContainerResponse

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

the class UriTest method testGetParam2.

@Test
public void testGetParam2() throws ExecutionException, InterruptedException {
    initiateWebApplication(Resource2.class);
    final ContainerResponse response = apply(RequestContextBuilder.from("/test/parameter", "GET").build());
    assertEquals("http://oracle.com/parameter", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 65 with ContainerResponse

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

the class UriTest method testManagedClientInjection2.

@Test
public void testManagedClientInjection2() throws ExecutionException, InterruptedException {
    final ResourceConfig resourceConfig = new ResourceConfig(Resource4.class);
    resourceConfig.property(Managed.class.getName() + ".property.test-property", "test-value");
    initiateWebApplication(resourceConfig);
    final ContainerResponse response = apply(RequestContextBuilder.from("/test/2", "GET").build());
    assertEquals("test-value", response.getEntity());
}
Also used : ContainerResponse(org.glassfish.jersey.server.ContainerResponse) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) 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