examples.servlets
Class CookieServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byexamples.servlets.CookieServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class CookieServlet
extends javax.servlet.http.HttpServlet

This simple servlet class demonstrates the usage of cookies. It is possible to set cookies (send them to the browser) and deleting them by setting a zero time to live.

Class was modified that it demonstrates the usage of sessions as well.

This servlet needs a file called cookie.html (included as comment at the end of this java file) either in the current directory where the semoa server is running or on its package directory (not possible when loaded from a jar file).

Version:
"$Id: CookieServlet.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Roger Hartmann
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.servlet.http.HttpServlet
 
Fields inherited from class javax.servlet.GenericServlet
 
Constructor Summary
CookieServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Handles the get request - the only one supported by this servlet.
 String getServletInfo()
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CookieServlet

public CookieServlet()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse res)
           throws javax.servlet.ServletException,
                  IOException
Handles the get request - the only one supported by this servlet.

Throws:
javax.servlet.ServletException
IOException

getServletInfo

public String getServletInfo()


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.