• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chapter 12 Coffee Cram

 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Question 5, (iv) option: Filters upport an init mechianism that includes an init() method tha tis guaranteed to be called before the filter is used to handle request:

Isn't the above otpion correct. Because filter does provide an init mechanism.

2) How can a filters doFilter() block further request processing?
 
wise owen
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

2) How can a filters doFilter() block further request processing?


Just simple "return;" without calling chain.doFilter();

Invoke the next entity in the filter chain. If the current filter is the last filter in the chain that ends with the target Web component or static resource, the next entity is the resource at the end of the chain; otherwise, it is the next filter that was configured in the WAR. It invokes the next entity by calling the doFilter method on the chain object (passing in the request and response it was called with, or the wrapped versions it may have created). Alternatively, it can choose to block the request by not making the call to invoke the next entity. In the latter case, the filter is responsible for filling out the response.
 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay I get it, but what about the question 1 that I asked. Is the an errata?
 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The errata says that option D is also one of the correct choices for Question 5.
 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Reshma ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic