JAVA Servlets and Key Methods
Java Servlets and Key Methods to Review
-
HttpServlet
doGet(HttpServletRequest req, HttpServletResponse resp)
doPost(HttpServletRequest req, HttpServletResponse resp)
doPut(HttpServletRequest req, HttpServletResponse resp)
doDelete(HttpServletRequest req, HttpServletResponse resp)
doCopy
doOptions
service(HttpServletRequest req, HttpServletResponse resp)
init(ServletConfig config)
destroy()
-
Filter
doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
init(FilterConfig filterConfig)
destroy()
-
ServletContextListener
contextInitialized(ServletContextEvent sce)
contextDestroyed(ServletContextEvent sce)
-
HttpSessionListener
sessionCreated(HttpSessionEvent se)
sessionDestroyed(HttpSessionEvent se)
-
HttpServletRequest
getParameter(String name)
getParameterValues(String name)
getHeader(String name)
getCookies()
getSession()
getAttribute(String name)
getRequestURI()
-
HttpServletResponse
setContentType(String type)
setHeader(String name, String value)
addCookie(Cookie cookie)
sendRedirect(String location)
getWriter()
getOutputStream()
-
HttpSession
setAttribute(String name, Object value)
getAttribute(String name)
removeAttribute(String name)
invalidate()
setMaxInactiveInterval(int interval)
-
ServletContext
getAttribute(String name)
setAttribute(String name, Object object)
getInitParameter(String name)
getRealPath(String path)
-
Custom Authentication Servlets
login(String username, String password)
logout()
isUserInRole(String role)
-
File Upload Handling
getPart(String name)
(in HttpServletRequest)write(String fileName)
(in Part interface)
-
WebSocket
@OnOpen
@OnMessage
@OnClose
@OnError
-
Spring Framework Controllers
- Methods annotated with
@RequestMapping
,@GetMapping
,@PostMapping
, etc. @InitBinder
methods@ModelAttribute
methods
- Methods annotated with