What are Servlet Filters ?  Discuss about customization of request and response using filtersFilters are used to process the content in the request or response objects         of Servlets and generally they do not produce the responses.   Filters interrupt
Requestsbefore the servlet was processed
Response immediately after the request was processed or before the     response sent to the client  Enhances the lifecycle process
  Used to perform various functions across the multiple servlets in a Web       application   To add features to existing servlet code
  Also create reusable functions to use in multiple Web applicationsWhat are Servlet Filters ?Example   Customize the authentication process using filter
  Filter intercepts the request - check whether the sufficient permission was       given to the user to access the requested servlet Prevent the unauthorized user from accessing the servlet   Used to record
  User actions
  Compress the output streams
  Very flexible because we won’t write the filters within servlets
  Configured in the web.xmlWhat are Servlet Filters ?Implementation of FilterRequestRequestResponseResponseClientSampleFilter.javaSample Servlet.javaFilterServlet

Servlet Filters

  • 1.
    What are ServletFilters ? Discuss about customization of request and response using filtersFilters are used to process the content in the request or response objects of Servlets and generally they do not produce the responses. Filters interrupt
  • 2.
  • 3.
    Response immediately afterthe request was processed or before the response sent to the client Enhances the lifecycle process
  • 4.
    Usedto perform various functions across the multiple servlets in a Web application To add features to existing servlet code
  • 5.
    Alsocreate reusable functions to use in multiple Web applicationsWhat are Servlet Filters ?Example Customize the authentication process using filter
  • 6.
    Filterintercepts the request - check whether the sufficient permission was given to the user to access the requested servlet Prevent the unauthorized user from accessing the servlet Used to record
  • 7.
    Useractions
  • 8.
    Compressthe output streams
  • 9.
    Veryflexible because we won’t write the filters within servlets
  • 10.
    Configuredin the web.xmlWhat are Servlet Filters ?Implementation of FilterRequestRequestResponseResponseClientSampleFilter.javaSample Servlet.javaFilterServlet