Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

about Piotr's mock exam question 18

 
Ranch Foreman
Posts: 1898
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


Q18 - Filter Dispatching [2]
Consider the following <filter-mapping> element in the Deployment Descriptor:
<filter-mapping>
<filter-name>NullHaus Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

a. This filter-mapping is valid and the "NullHaus Filter" will be accessed each time a request is made to the web application,
b. This filter-mapping is valid and the "NullHaus Filter" will be accessed only if the request is made to the web application root context (/)
c. This filter-mapping is valid and the "NullHaus Filter" will be accessed each time a request is dispatched from a RequestDispatcher obtained either by name or path
d . This filter-mapping is invalid

answer : a

Explanation: The wildcard matches all requests made to the web application. The filter mapping configuration lacks the <dispatcher>...</dispatcher> element, so RequestDispatcher operations will not pass the filter.


One note I want to add :
In this explanation, the filter mapping does not have <dispatcher>. It means the same as <dispatcher>REQUEST</dispatcher> by default, any request.getRequestDispatcher.forward(\*) or request.getRequestDispatcher.include(\*) will not pass a filter.
 
A teeny tiny vulgar attempt to get you to buy our stuff
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic