Tuesday, 9 September 2014

servlets

Basics

      What is Servlet ?
      CGI vs Servlets
      Servlet Container
      How does Servlet Container work?
      Clients and Servers
      HTTP Protocol
      Web server
      Application Server
      HTTP Request
      Web server Vs Application Server
      Servlet Container Vs Application Server
      Hello World Servlet Application
            Analyze Hello World Application
            Why Servlet Mapping required ?
      Servlet Life Cycle

Servlet Interface

      Servlet Interface
      init method
      service method
      destroy method
      Get Servlet Config
      Get the servlet information

Http Servlet

      HttpServlet class
      doGet method
      doPost method
      doDelete method
      doHead method
      doOptions method
      doPut method
      doTrace method
      Get Last modified date of servlet

Request Object

      Request Object
      ServletRequest interface
      HttpServletRequest interface
      Get the Parameters
            Get the value associated with parameter
            Get all parameters as map
            Get all parameters as enum
            Get the Parameter Value
      File Upload
            File Upload : getPart (String name)
            File Upload : getParts()
      Attributes
            Get value associated with attribute
            Set attribute
            Get all the attribute names
            Remove the Attribute
      Accessing Headers
             Get all the header names
            Get values associated with the header
            Get value associated with the header
            Get the integer value associated with the header
            Get the date header
      Request Path Elements
            Get context path
            Get servlet path
            Get path information
      Path Translation Methods
            Get real path
            Get extra path after the servlet
      get the Cookies
      Asynchronous Processing
            Puts this request into asynchronous mode
            Start Asynchronous processing
            Gets the AsyncContext
            Checks whether request put into asynchronous mode
            Checks for Asynchronous mode support
      Get the Server Details
            Get the Server Name
            Get the Server Port
            Get the ip address on which the request received
            Gets the host name on which the request received
            Get the local port on which the request received
            getServerPort() vs getLocalPort()
      Get the name of the Http Requested method
      Get the Query string associated with the URL
      Character Encoding
            Set the Character Encoding
            Get the Character encoding used
      Get the content details
            Get the request body length
            Get the request body length
            gets the MIME type
      Read the body of the request
            Read Request body as binary form
            Read Request body as character data
      Get the Client acceptable locale
            Get the preferred locale of the client
            get all acceptable locales of the client
      Get the protocol used for the request
      Get the scheme used in the request
      Get the Client details
            Get the address of the client
            Get remote port of client
            Get the Host name of the client

Servlet Context

      Servlet Context
      Initialization Parameters
            Get the value of the named context-wide initialization parameter
            Get the names of the context's initialization parameters
      ServletContextListener
      @WebListener annotation
      Add Listeners Programmatically
      Add Servlet Programmatically to Servlet Context

Response

      Response object
      Buffering
            Set Buffer Size
            Get Buffer size
            Check response committed to client?
            Clears the buffer
            Reset Buffer
            reset Vs resetBuffer
            Flush Buffer
      Headers
            Set Header
            Add Header
      Redirecting request
      Sending Error
            sendError(int sc)
            sendError (int sc, String msg)

Filtering

      Filtering
      Filter interface
            init (FilterConfig filterConfig)
            doFilter (ServletRequest request, ServletResponse response, FilterChain chain)
            filter: destroy()
            Adding Filters to ServletContext
                  addFilter (String filterName, Class filterClass)
                  addFilter (String filterName, Filter filter)
                  addFilter (String filterName, String className)

Servlet Wrapper Classest

      Servlet Wrapper Classes
            HttpServletRequestWrapper
            HttpServletResponseWrapper

Cookies

      Cookies
      Example Of Cookie
      Create a Cookie
      Add a cookie to the response
      Get All Cookies
      Describe Cookie purpose
      get the comment related to this Cookie

Session Tracking

      Session Tracking
      Creating or Accessing a Session
      Simple Example on Session
      Change Session Id
      Checks whether given session comes as cookie
      Checks session ID came in as part of the request URL
       Checks whether the requested session ID is still valid

Dispatching Requests

      Dispatching Requests
      RequestDispatcher interface
            forward the request
            Includes the content of a resource in the response

Listeners

      Listeners
      ServletContextListener
            Add ServletContextListener using Deployement Descriptor
            Add ServletContextListener using WebListener Annotation
      ServletContextAttributeListener
            Add ServletContextAttributeListener using web.xml
            Add ServletContextAttributeListener Using WebListener Annotation
            Add ServletContextAttributeListener Using addListener
      ServletRequestListener
            Add ServletRequestListener using Deployment Descriptor
            Add ServletRequestListener using WebListener
            Add ServletRequestListener using addListener method
      ServletRequestAttributeListener
            Add ServletRequestAttributeListener using Deployment Descriptor
            Add ServletRequestAttributeListener using WebListener
            Add ServletRequestAttributeListener using addListener
      ReadListener
      WriteListener
      AsyncListener
      HttpSessionListener
            HttpSessionListener using Deployment Descriptor
            HttpSessionListener using WebListener
            HttpSessionListener using addListener
      HttpSessionIdListener
            HttpSessionIdListener using Deployment Descriptor
            HttpSessionIdListener using WebListener
            HttpSessionIdListener using addListener

Miscellaneous
      Restrict user access to servlets and jsps
      How Server generates session id
      Setting role based security in tomcat
      Setting form based authentication in tomcat
      Is HTTP Pipelining help?
      Load a resource from WEB-INF directory
      Cross-origin resource sharing (CORS) example using servlets
      Basic Authentication using servlets example

No comments:

Post a Comment