Servlet Classes and Interfaces


Servlet API is defined by the following two packages -
1- javax.servlet
2- javax.servlet.http
These packages define interfaces and classes that describe Servlet API.

Javax.servlet package -

It defines the classes and interface that can be used to create servlets but these classes and interfaces are not specific to HTTP.

Javax.servlet interfaces -

1- Servlet
2- ServletRequest
3- ServletResponse
4- ServletConfig
5- ServletContext
6- RequestDispatcher
7- ServletRequestListener
8- ServletRequestAttributeListener
9- ServletContextListener
10- ServletContextAttributeListener
11- Filter
12- FilterChain
13- FilterConfig
14- SingleThreadModel

Javax.servlet classes -

1- GenericServlet
2- ServletInputStream
3- ServletOutputStream
4- ServletRequestWrapper
5- ServletResponseWrapper
6- ServletRequestEvent
7- ServletContextEvent
8- ServletRequestAttributeEvent
9- ServletContextAttributeEvent

Exception classes -

10- ServletException
11- UnavailableException

javax.servlet.http package -

javax.servlet.http defines classes and interfaces that can also be used to create servlets but these classes and interfaces are HTTP specific. If you are using HTTP then you should use javax.servlet.http package.

javax.servlet.http interfaces -

1- HttpServletRequest
2- HttpServletResponse
3- HttpSession
4- HttpSessionListener
5- HttpSessionAttributeListener
6- HttpSessionBindingListener
7- HttpSessionActivationListener
8- HttpSessionContext

Javax.servlet.http classes -

1- HttpServlet
2- Cookie
3- HttpServletRequestWrapper
4- HttpServletResponseWrapper
5- HttpSessionEvent
6- HttpSessionBindingEvent
7- HttpUtils (deprecated now)

The details of these classes and interfaces will be covered ahead.