Classes

Estudies4you
Methods of HttpServlet Class
Classes
  • Cookie Class: Its holds piece of information that is stored in client machine. Examples includes the details of a user who visited a site. In his next visit to the same website, information can be retrieved using cookie. Thus user activities can be tracked
  • Using addCookie() of HTTPServletResponse, servlet can write a cookie with details like name, value, expiration of cookie and domain/path of cookie
Methods of Cookie Class
String getName( )
Provides Name
String getValue( )
Provides Value
String getPath( )
Provides Path that cookie holds
int getVersion( )
Provides the version of Cookie
String getComment( )
Comment of Cookie
Object clone()
Provides copy of object.
void setValue(String v)
Sets value in Cookie
void setPath(String p_value)
Sets path to p_value
void setComment(String c_value)
Sets comment to c_value
void setSecure(boolean secure)
Sets the security flag to secure.
  
  • HttpServlet Class: This is used while developing servlets that process and retrieves HTTP Requests. This class extends Generic Servlets
  • All the methods takes HttpServletRequest(req) and HttpServletResponse(res) as parameters and returns void. All the methods throw I0Exception, ServletException
Methods of HttpServlet  Class
doGet(req,res)
Handles HTTP GET Type of Requests
doHead(req,res)
Handles HTTP HEAD Type of Requests
doOptions(req,res)
Handles HTTP OPTIONS Type of Requests
doPost(req,res)
Handles HTTP POST Type of Requests
doPut(req,res)
Handles HTTP PUT Type of Requests
doTrace(req,res)
Handles HTTP TRACE Type of Requests
doDelete(req,res)
Handles HTTP DELETE Type of Requests
servicereq,res)
Called when request is received.
  • HttpSessionEvent Class: This works mainly based on events. This contains session events which extends EventObject. This class is created for every change in session
Methods of HttpSessionEvent Class
HttpSession getSession( )
Returns Session in which event occurred.
  • HttpSessionBindingEvent Class: This extends HTTPSessionEvent. In an HTTPSession Object, it is generated when a listener is bound or unbound
Methods of HttpSessionBindingEvent Class
String getName()
The name that is bound or unbound
HttpSession getSession( )
Returns the session to which listener is bound or unbound
Object getValue( )
Returns the value of attribute that is bound or unbound.


To Top