Search in sources :

Example 36 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsPrimitiveTest method _testDefault.

void _testDefault(String base, String type, String value) throws ExecutionException, InterruptedException {
    assertEquals("content", apply(RequestContextBuilder.from(base + "default/null", "GET").accept("application/" + type).build()).getEntity());
    assertEquals("content", apply(RequestContextBuilder.from(base + "default", "GET").accept("application/" + type).build()).getEntity());
    assertEquals("content", apply(RequestContextBuilder.from(base + "default/override", "GET").accept("application/" + type).cookie(new Cookie(type, value)).build()).getEntity());
}
Also used : Cookie(javax.ws.rs.core.Cookie)

Example 37 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsPrimitiveTest method testBadPrimitiveValue.

@Test
public void testBadPrimitiveValue() throws ExecutionException, InterruptedException {
    final ContainerResponse responseContext = apply(RequestContextBuilder.from("/", "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)

Example 38 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsStringTest method testListGet.

@Test
public void testListGet() throws ExecutionException, InterruptedException {
    initiateWebApplication(ResourceStringList.class);
    _test("/", "application/list", new Cookie("args", "a"));
}
Also used : Cookie(javax.ws.rs.core.Cookie) Test(org.junit.Test)

Example 39 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsStringTest method testStringGet.

@Test
public void testStringGet() throws ExecutionException, InterruptedException {
    initiateWebApplication(ResourceString.class);
    _test("/", new Cookie("arg1", "a"), new Cookie("arg2", "b"), new Cookie("arg3", "c"));
}
Also used : Cookie(javax.ws.rs.core.Cookie) Test(org.junit.Test)

Example 40 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsStringTest method testStringListEmptyGet.

@Test
public void testStringListEmptyGet() throws ExecutionException, InterruptedException {
    initiateWebApplication(ResourceStringListEmpty.class);
    _test("/", "application/stringlist", new Cookie("args", ""));
}
Also used : Cookie(javax.ws.rs.core.Cookie) Test(org.junit.Test)

Aggregations

Cookie (javax.ws.rs.core.Cookie)80 Test (org.junit.Test)40 Response (javax.ws.rs.core.Response)18 HashMap (java.util.HashMap)12 WebTarget (javax.ws.rs.client.WebTarget)12 HttpServletResponse (javax.servlet.http.HttpServletResponse)10 MultivaluedMap (javax.ws.rs.core.MultivaluedMap)8 NewCookie (javax.ws.rs.core.NewCookie)7 ContainerResponse (org.glassfish.jersey.server.ContainerResponse)7 Map (java.util.Map)5 Message (org.apache.cxf.message.Message)5 Entitlement (com.sun.identity.entitlement.Entitlement)4 EntitlementSubject (com.sun.identity.entitlement.EntitlementSubject)4 Privilege (com.sun.identity.entitlement.Privilege)4 PrivilegeManager (com.sun.identity.entitlement.PrivilegeManager)4 ClientResponse (com.sun.jersey.api.client.ClientResponse)4 HttpHeaders (javax.ws.rs.core.HttpHeaders)4 MultivaluedHashMap (javax.ws.rs.core.MultivaluedHashMap)4 BeforeClass (org.testng.annotations.BeforeClass)4 SSOToken (com.iplanet.sso.SSOToken)3