Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filters

 
Sophie Angela
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can filters be used to create request and response wrappers?

if so why?


can Wrappers be used to create filters?
 
Arunava Bhattacharya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes..filters can be used to make wrappers.This is because you might want to compress the response you are getting from a servlet and you can create your own custom response object and pass it as a parameter to the chain.doFilter(req,res) method.

For details of this please refer to HFSJ book.It has been explained beautifully there.Though you do not need to know it in detail.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is phrasing it a bit strangely- filters are not used to create wrappers or vice versa. In a filter you'd create a wrapper if necessary (it's not required).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic