What are Servlet Filters?


What are Servlet Filters?

Ninja Asked on 19th September 2018 in Servlet.
Add Comment
1 Answer(s)
Best answer

A filter is a servlet that can transform the content of HTTP requests, responses, and header information. Filters do not generally create a response or respond to a request as servlets do, rather they modify or adapt the requests for a resource, and modify or adapt responses from a resource. Filters can act on dynamic or static content.

Filters are typically used for the following:

  • Accessing of a resource before a request to it is invoked.
  • Processing of the request for a resource before it is invoked.
  • Modification of request headers and data by wrapping the request in customized versions of the request object.
  • Modification of response headers and response data by providing customized versions of the response object.
  • Interception of an invocation of a resource after its call.
  • Actions on a servlet, on groups of servlets, or static content by zero, one, or more filters in a specifiable order.
Ninja Answered on 19th September 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.