• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q on Request filters and Response filters?

 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How do we know whether a filter is a request filter or a response filter? It doesn't specify in DD.

Thanks,
Jenny
 
shiva viswanathan
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jenny,

As per the spec there is no differentiation between a request and response filter

Both are configured the same way using the DD

Both implement the same interface Filter

It becomes a request or response filter depending on how
the developer uses it

Thanks
Shiva
 
Jingh Yi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shiva,

Does a request filter manipulate the request object while a response filter manipulate the response object? HFSJ pp675 gives an example on how to define a request filter. Can you give an example of response filter? Is a response filter being called after the servlet/url? How do we make that happen? I think the examples in HFSJ only show how to invoke a filter before servlet/url.

Thanks a bunch!
Jenny
 
shiva viswanathan
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jenny ,

Thats right response filter modifies the response before it is sent to
the client after the servlet's doGet or doPost finishes executon

Its a bit complicated to explain in a post so you can read it in detail
in the filters chapter in HFSJ in the last part of the chapter.
HFSJ gives a detailed explanation on this .

Catch You Later
Shiva
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic