O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating your own interceptor

Interceptors can be configured to execute before and after a method is executed. This permits moving orthogonal functionality out of the method thus reducing the complexity and clutter of the method. As we have seen in previous chapters, interceptors have been used for a variety of tasks such as handling transactions and security. In this recipe, we will demonstrate the technique for creating our own interceptors to meet any unique requirements of our application.

Getting ready

The process to create and use an interceptor involves:

  1. Creating an interceptor binding to define the characteristics of the interceptor
  2. Implementing the interceptor class
  3. Adding the interceptor to the application

    An interceptor binding is used to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required