import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class ReadCookie extends HttpServlet {
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
				
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		
		Cookie []cookie = request.getCookies();
		if(cookie == null)
			return;
		for(int i=0; i<cookie.length; i++) {
			if(cookie[i].getName().equals("name"))
				out.println("<h5>Got it, name=" +cookie[i].getValue() +"</h5><BR>");
			else
				out.println("<h5>"+ cookie[i].getName() +"="+ cookie[i].getValue() +"</h5><BR>");
		}
	}
}