From the course: Java EE 7: Web Services

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Interceptors and filters

Interceptors and filters - Java EE Tutorial

From the course: Java EE 7: Web Services

Start my 1-month free trial

Interceptors and filters

- [Instructor] Let's learn about interceptors and filters and how useful they can be. Interceptors and filters are useful techniques that allow you to capture a request before it is handled by your application or a response before it is sent to the client. All requests or responses to and from your application can be captured on an application wide level and you can manipulate them any way that you see fit. Why would you want to do this? So for example, you may have needs around logging and you want to log specific information about all requests coming to your application. Or you're concerned about security and you want to ensure all requests to your API are authenticated and authorized. And that will be our use case sample for today. And what about encryption? You may need to encrypt messages. An interceptor gives developers access to the message body. A filter gives developers access to all the messages that pass through. Filter can easily access query parameters, HTTP headers, et…

Contents