use of javax.ws.rs.core.HttpHeaders in project cxf by apache.
the class HttpHeadersImplTest method testGetCookies.
@Test
public void testGetCookies() throws Exception {
Message m = createMessage(createHeader(HttpHeaders.COOKIE, "a=$b;c=d"));
HttpHeaders h = new HttpHeadersImpl(m);
Map<String, Cookie> cookies = h.getCookies();
assertEquals(2, cookies.size());
assertEquals("$b", cookies.get("a").getValue());
assertEquals("d", cookies.get("c").getValue());
}
use of javax.ws.rs.core.HttpHeaders in project cxf by apache.
the class HttpHeadersImplTest method testGetCookiesWithAttributes.
@Test
public void testGetCookiesWithAttributes() throws Exception {
Message m = createMessage(createHeader(HttpHeaders.COOKIE, "$Version=1;a=b, $Version=1;c=d"));
HttpHeaders h = new HttpHeadersImpl(m);
Map<String, Cookie> cookies = h.getCookies();
assertEquals(2, cookies.size());
Cookie cookieA = cookies.get("a");
assertEquals("b", cookieA.getValue());
assertEquals(1, cookieA.getVersion());
Cookie cookieC = cookies.get("c");
assertEquals("d", cookieC.getValue());
assertEquals(1, cookieA.getVersion());
}
use of javax.ws.rs.core.HttpHeaders in project cxf by apache.
the class HttpHeadersImplTest method testGetHeader2.
@Test
public void testGetHeader2() throws Exception {
Message m = createMessage(createHeaders());
HttpHeaders h = new HttpHeadersImpl(m);
List<String> values = h.getRequestHeader("a");
assertEquals(2, values.size());
assertEquals("1", values.get(0));
assertEquals("2", values.get(1));
}
use of javax.ws.rs.core.HttpHeaders in project cxf by apache.
the class HttpHeadersImplTest method testGetLanguage.
@Test
public void testGetLanguage() throws Exception {
Message m = createMessage(createHeader(HttpHeaders.CONTENT_LANGUAGE, "en-US"));
HttpHeaders h = new HttpHeadersImpl(m);
assertEquals("en_US", h.getLanguage().toString());
}
use of javax.ws.rs.core.HttpHeaders in project cxf by apache.
the class HttpHeadersImplTest method testGetMissingContentLength.
@Test
public void testGetMissingContentLength() throws Exception {
Message m = createMessage(new MetadataMap<String, String>());
HttpHeaders h = new HttpHeadersImpl(m);
assertEquals(-1, h.getLength());
}
Aggregations