use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class CookieParamAsStringTest method testStringPost.
@Test
public void testStringPost() throws ExecutionException, InterruptedException {
initiateWebApplication(ResourceString.class);
final ContainerResponse responseContext = apply(RequestContextBuilder.from("/", "POST").cookie(new Cookie("arg1", "a")).cookie(new Cookie("arg2", "b")).cookie(new Cookie("arg3", "c")).entity("content").build());
assertEquals("content", responseContext.getEntity());
}
use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class CookieParamStringConstructorTest method testStringConstructorDefaultOverride.
@Test
public void testStringConstructorDefaultOverride() throws ExecutionException, InterruptedException {
initiateWebApplication(ResourceStringDefault.class);
_test("/", new Cookie("args", "2.718"));
}
use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class CookieParamStringConstructorTest method testStringConstructorListGet.
@Test
public void testStringConstructorListGet() throws ExecutionException, InterruptedException {
initiateWebApplication(ResourceStringList.class);
_test("/", "application/stringlist", new Cookie("args", "3.145"));
}
use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class CookieParamStringConstructorTest method testStringConstructorListDefaultOverride.
@Test
public void testStringConstructorListDefaultOverride() throws ExecutionException, InterruptedException {
initiateWebApplication(ResourceStringListDefaultOverride.class);
_test("/", new Cookie("args", "2.718"));
}
use of javax.ws.rs.core.Cookie in project jersey by jersey.
the class FormResource method processForm.
/**
* Process the form submission. Produces a table showing the form field
* values submitted.
* @return a dynamically generated HTML table.
* @param formData the data from the form submission
*/
@POST
@Consumes("application/x-www-form-urlencoded")
public String processForm(MultivaluedMap<String, String> formData) {
StringBuilder buf = new StringBuilder();
buf.append("<html><head><title>Form results</title></head><body>");
buf.append("<p>Hello, you entered the following information: </p><table border='1'>");
for (String key : formData.keySet()) {
if (key.equals("submit")) {
continue;
}
buf.append("<tr><td>");
buf.append(key);
buf.append("</td><td>");
buf.append(formData.getFirst(key));
buf.append("</td></tr>");
}
for (Cookie c : headers.getCookies().values()) {
buf.append("<tr><td>Cookie: ");
buf.append(c.getName());
buf.append("</td><td>");
buf.append(c.getValue());
buf.append("</td></tr>");
}
buf.append("</table></body></html>");
return buf.toString();
}
Aggregations