Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

Filters and Wrappers : Complete Tutorial

Share this post!
 Vote this!

Filters can intercept the request and also control the response all without the servlet knowing, which means that filters can be used without touching the servlets code, filters can be a very powerful tool.
Filters are Java components (very similar to servlets) that you can use to intercept and process requests before that are sent to the servlet, or to process responses after the servlet has completed, but before the response goes back to the client. The Container decides when to invoke your filters based on the declarations in the DD, the DD maps which filters will be called for which request URL patterns.
The are many things that you can do with filters
  • perform security checks (request)
  • reformat request headers or bodies (request)
  • audit or log requests (request)
  • compress the response stream (response), I have an example of this below
  • append or alter the response stream (response)
  • create a different response altogether (response)  more...

0 comments:

Post a Comment