This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
A 3rd party filter (and therefore not modifyable through me) usually handles all requests and responses coming and going to a certain path like
On certian occasions I just want to filter to request data , but not the response ... Is there any way to intererupt the filterchain so that the response can be sended out without this filter handling it ?
I don't think you can interrupt the filter chain. But you could implement your own filter that is invoked for the same path, and put your filter in the chain prior to 3rd party filter. Your filter would receive the response from the 3rd party filter and could then manipulate the response as desired.
Can I modify the HttpServletRequest ServletPath through a filter ? I am not quite sure where to find it, the object itself only provides a getter ...
Joined: Jan 26, 2010
I'm not familiar with any way to change the servlet path, why would you want to do so? If you do not want the 3rd party filter to be invoked than you can bypass it by having your filter skip invocation of the FilterChain.doFilter method. Of course doing so would also mean that the servlet that is to handle the request will not be invoked. The following is my understanding of the flow:
Web Container --> Your Servlet Filter --> 3rd Party Servlet Filter --> Servlet
The way the chain is continued is by each servlet filter invoking the doFilter method on the FilterChain instance that is passed to the filter's doFilter method. Once the servlet has completed processing then the flow returns back up the chain.