Servlet uses classes and interfaces from two packages: javax.servlet and javax.servlet.http.They constitute servlet API. Keep in mind that these packages are not part of the Core java packages. Instead, they are a standard extension. Therefore, they are not included in the Java software development kit. you must download tomcat to obtain their functionality
Read: Introduction to Servlet
javax.servlet.GenericServlet or javax.servlet.http.HttpServlet.
A GenericServlet class provides the implementation of the basic life cycle method of the servlet. The service() method of GenericServlet class accepts two parameters: a request object and a response object. The request object is used to read the data from a client request and response object is used to write data to a client request.
In contrast, an HTTP servlet usually does not override the service() method
Instead, it override doGet() method to handle the GET request and doPost() method to handle the post requests. An HTTP servlet can override either or both of these methods, depending on the type of requests it needs to handle. An HTTP servlet can override doPut() and doDelete() methods to handle PUT and DELETE requests respectively.However,HTTP servlet generally don't touch doTrace() or doOption().
The ServletRequest and ServletResponse classes in javax.servlet is used to read the data from a client request and write the data to a client response, While HttpServletRequest and HttpServletResponse in javax.Servlet.http package also contains an HttpSession class that provide built-in session tracking functionality and a cookie class that allows you to quickly set up and process HTTP cookies.
Interfaces in javax.servlet package:
1. servlet
2. servletRequest
3. servletResponse
4. servletConfig
5. servletContent
6. servletThreadModel.
7. RequestDispatcher
8. Filter
9. Filterchain
10. FilterConfig.
2. servletRequest
3. servletResponse
4. servletConfig
5. servletContent
6. servletThreadModel.
7. RequestDispatcher
8. Filter
9. Filterchain
10. FilterConfig.
Classes in javax.servlet package:
1. GenericServlet
2. ServletInputStream
3. ServletOutputStream
4. servletRequestWrapper
5. servletResponseWrapper
6. ServletException
7. unavailabale Exception
8. ServletRequestEvent
9. servletContentEvent
10. servletRequestAttributeEvent
2. ServletInputStream
3. ServletOutputStream
4. servletRequestWrapper
5. servletResponseWrapper
6. ServletException
7. unavailabale Exception
8. ServletRequestEvent
9. servletContentEvent
10. servletRequestAttributeEvent
Interfaces in javax.servlet.http package:
1. HttpServletRequest
2. HttpServletResponse
3. HttpSession
4. HttpSessionContext
5. HttpSessionAttributeLIstner
6. HttpSessionActivationListner
7. HttpSessionBindingListner
2. HttpServletResponse
3. HttpSession
4. HttpSessionContext
5. HttpSessionAttributeLIstner
6. HttpSessionActivationListner
7. HttpSessionBindingListner
Classes in javax.servlet.http package:
1. HttpServlet
2. cookie
3. HttpServletRequestWrapper HttpServletResponseWrapper
4. HttpSessionEvent
5. HttpSessionBindingEvent
6. Httputils.
2. cookie
3. HttpServletRequestWrapper HttpServletResponseWrapper
4. HttpSessionEvent
5. HttpSessionBindingEvent
6. Httputils.
Servlet API in Java
Reviewed by Prashant Srivastava
on
October 09, 2018
Rating:
No comments: