In the servlet basically two packages contains the classes and interfaces which are used to develop servlet programs. They are as follows:
- javax.servlet package
- javax.servlet.http package
It is having following classes and interfaces. all these classes and interfaces are shown in figure below.
- Servlet interface:
- It is having the methods which define the life cycle of servlet.
- ServletConfig interface:
- It provides basic or initialization parameter of the servlet.
- ServletContext interface:
- It provides the runtime environment to the servlet. It also logs the events using log().
- GenericServlet class:
- It implements the Servlet, ServletConfig and Serialization interface.
- ServletRequest interface:
- It is used to read the client request.
- ServletResponse interface:
- It is used to write the response data.
- ServletException class:
- It defines that servlet occurred errors.
- UnavailableException class:
- It defines that servlet is permanently or temporarily not available.
- ServletInputStream class:
- It provides input stream to read the data from the client request.
- ServletOutputStream class:
- It provides output stream to writing the data as a response to client.
- SingleThreadModel interface:
- It provides the mechanism to make servlet thread safe.
It is having following classes and interfaces. Following classes and interfaces commonly used by programmers and it provides the facility to the servlet to work with HttpRequest and HttpResponses. All these classes and interfaces are shown in figure below.
- HttpServlet class:
- It provides the methods of handling HTTP request and HTTP response.
- HttpServletRequest interface:
- It allows the servlet to read the data from HTTP request.
- HttpServletResponse interface:
- It allows the servlet to write the data to an HTTP response.
- Cookie class:
- It is used to store the state information at client side or on the client machine.
- HttpSession interface:
- It is used to create session and provides the way of reading and writing the session and accessing the information related to session.
- HttpSessionBindingListener interface:
- It informs the object that it is bound or unbound to the session.
- HttpSessionEvent class:
- It wrap ups the session change events.
- HttpSessionBindingEvent class:
- It defines that when session should be bound or unbound with the object value and its attributes.