package org.jscookie.test.integration.encoding;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet( "/encoding" )
public class EncodingServlet extends HttpServlet {
	private static final long serialVersionUID = 1;
	@Override
	public void doGet( HttpServletRequest request, HttpServletResponse response )
	throws ServletException, IOException {
		System.out.println( "EXECUTED SERVLET: " + request.getParameter( "name" ) );
	}
}

@@ -287,16 +287,99 @@
 ponse;%0A%0A
+import org.jscookie.Cookies;%0A%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0A%0A
 @WebServ
@@ -634,85 +634,745 @@
 %0A%09%09S
-ystem.out.println( %22EXECUTED SERVLET: %22 + request.getParameter( %22name%22 ) );%0A%09%7D%0A%7D%0A
+tring name = request.getParameter( %22name%22 );%0A%0A%09%09System.out.println( %22--------------------%22 );%0A%09%09System.out.println( %22Testing: %22 + name );%0A%0A%09%09Cookies cookies = new Cookies( request, response );%0A%09%09String value = cookies.get( name );%0A%0A%09%09System.out.println( %22Value: %22 + value );%0A%09%09System.out.println( %22--------------------%22 );%0A%0A%09%09cookies.set( name, value );%0A%0A%09%09response.setContentType( %22application/json%22 );%0A%09%09new ObjectMapper()%0A%09%09%09.writeValue( response.getOutputStream(), new Result( name, value ) );%0A%09%7D%0A%7D%0A%0Aclass Result %7B%0A%09private String name;%0A%09private String value;%0A%09Result( String name, String value ) %7B%0A%09%09this.name = name;%0A%09%09this.value = value;%0A%09%7D%0A%09public String getName() %7B%0A%09%09return name;%0A%09%7D%0A%09public String getValue() %7B%0A%09%09return value;%0A%09%7D%0A%7D

Provide a proper return for each request