From the course: Java EE: Design Patterns and Architecture
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
The Filter design pattern
From the course: Java EE: Design Patterns and Architecture
The Filter design pattern
- [Instructor] The filter design pattern is used to perform pre-processing and post-processing of requests and responses to and from the application. The filter pattern is also often referred to as the intercepting filter pattern. It is a common enterprise pattern and is used extensively in the Java E Ecosystem. It is often used by frameworks to implement cross cutting concerns in the web tier, such as security. Now in Java EE, the filter pattern is most commonly used in combination with servlets. Servlets operate in the web tier and handle HTTP requests and responses. The role of filters is to implement requests and responses, and perform some useful action. A filter may examine and alter a request or response before it reaches either the target servlet or the client. Typical examples of filter usage would be authenticating a request, applying security policies, logging, compression, and encryption. In many ways you can think of servlet filters as a variant of the interceptor pattern…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.