Wednesday, July 1, 2009

javax servlet package

  • Javax.servlet: It defines several basic classes and interfaces to build servlets from the scratch irrespective of any protocol.
  • Javax.servlet.http: This package contain several more convenient classes and interfaces (which extends classes and interfaces of javax.servlet package) to build servlets specific to http. It also contain several extra utility classes and interfaces like cookies http session(interface for developing web applications efficiently.
JAVAX.SERVLET PACKAGE:
This package contains the following important interfaces:
1.Servlet Interface: It defines several methods which must be implemented by every servlet in java either directly or indirectly.
- this is the interface which define life cycle methods of interface.
2.Servlet Request : The servlet Request object contain client information which can be used by servlet to generate response.
3.Servlet Response : servlet response object contain the response which can sent to the client . ex:servlet uses servlet response object it send response to the client.
4.Servlet config : it contains the configuration or deployment information of start up information of the servlet.Web container creates a separate servlet and pass configuration information to the server by using this object.
5.Servlet context : Servlet context in the object which can be used by servlet to communicate with web server.For every web application one servlet context object will create by using the servlet context object servlet can get servlet context object.
6. Request Dispatcher: This object can be used by servlet to redirect the requests for another web component (servlet/jsp). This interface contain forward and include methods.
7. Single Thread Model: This interface can be implementing by servlet to generate that it can process only one request at a time.This is the deprecated interface and there is no replacement control 2.4. version.It does not contain any methods. So this is a MARKER INTERFACE.

These packages contain the following important classes.

  1. GenericServlet: to implement Generic protocol independent servlets.
  2. ServletInputStream: provides an input stream for reading binary data from a client request.
  3. ServletOutputStream: provides an output stream for reading binary data from a client request.This package defined the following Exception
  4. ServletException: Defines a general Exception. A servlet can throw when it fare some difficulty whose processing client request.
  5. UnavailableException: Defines an Exception that a servlet throws to indicate that the servlet is unavailable permanently or temporally.

0 comments:

Post a Comment