Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Filter between two servlets (Forwarding)  RSS feed

 
Sean Hetfield
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder when a filter applied between two servlets (servlet A forwrds to server B), at the time of come back, is the outgoing response going through filter again or because forwarding happened between the two servlets, the response goes directly back to the client from servlet B (and not going through filter again)?

Thanks

Sean
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Metariya:
I wonder when a filter applied between two servlets ...


Seems like any easy enough premise to test with logging or a few simple print statements in the filters.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using a container that supports version 2.4 of the servlet spec, take a look at section SRV.6.2.5 (there is link to the spec in my signature).

It covers the different ways to configure filters, including how to configure them to be invoked under requestDispatcher forward and included calls.
 
Sean Hetfield
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have looked at Spec and there (SRV 6.2.5) and I couldn't find my answer.

To re-phrase my question:

Is it mandatory that outgoing response to go through filter chain or not (even if there is no process being done)?

Thanks

Sean
 
Sean Hetfield
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any Idea?

Thanks

Sean
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sean Hetfield:
Any Idea?


Yes:

Seems like any easy enough premise to test with logging or a few simple print statements in the filters.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!