Page: 7
Unit- 3: The Web Container Model
Q19. Click the Exhibit button. Given the web application deployment descriptor elements: 11. <filter> 12. <filter-name>ParamAdder</filter-name> 13. <filter-class>com.example.ParamAdder</filter-class> 14. </filter> 31. <filter-mapping> 32. <filter-name>ParamAdder</filter-name> 33. <servlet-name>Destination</servlet-name> 34. </filter-mapping> ... 55. <servlet-mapping> 56. <servlet-name>Destination</servlet-name> 57. <url-pattern>/dest/Destination</url-pattern> 58. </servlet-mapping> What is the result of a client request of the Source servlet with no query string? 
A. The output "filterAdded = null" is written to the response stream. B. The output "filterAdded = addedByFilter" is written to the response stream. C. An exception is thrown at runtime within the service method of the Source servlet. D. An exception is thrown at runtime within the service method of the Destination servlet. Answer: A Q20.Given a Filter class definition with this method: 21. public void doFilter(ServletRequest request, 22. ServletResponse response, 23. FilterChain chain) 24. throws ServletException, IOException { 25. // insert code here 26. } Which should you insert at line 25 to properly invoke the next filter in the chain, or the target servlet if there are no more filters? A. chain.forward(request, response); B. chain.doFilter(request, response); C. request.forward(request, response); D. request.doFilter(request, response); Answer: B
Page: 7
1
2
3
4
5
6
7
8
9
10
|