How should filters be configured to apply only to certain URL patterns in a web application?
- Configure in the web.xml file
- Filters automatically apply to all URLs
- Specify URL patterns in the filter mapping in the deployment descriptor
- Use annotations in the filter class
Filters should be configured to apply only to certain URL patterns by specifying those patterns in the filter mapping in the deployment descriptor (web.xml).
Loading...
Related Quiz
- In a chat application using WebSockets, when a message is sent to a closed connection, what happens and how should it be handled?
- The method __________ is used to set the length of the content body in the response.
- How does a Content Security Policy (CSP) help in preventing XSS attacks?
- How does a servlet container typically interact with a connection pool?
- How do you set a response header to indicate the content should be downloaded as a file?