• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about Piotr's mock exam question 18

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic