In what scenario would a filter be used instead of a servlet?
- For authentication and logging
- For handling HTTP requests
- For managing session state
- For processing business logic
Filters are typically used for tasks such as authentication, logging, and modifying the request and response. In scenarios where the primary purpose is not to generate a response, but to perform pre or post-processing, filters are preferred over servlets.
Loading...
Related Quiz
- The __________ API in Java EE is used for declarative security in web applications.
- Describe the role of Subresource Integrity (SRI) in preventing XSS attacks.
- When optimizing memory usage in a Java application, what strategies should be considered?
- In an advanced MVC framework, how is the decision made in a servlet to select a specific view based on business logic?
- Describe how you would configure a filter to initialize with predefined parameters.