© Brent Watson 2015
Brent WatsonStripes by Example10.1007/978-1-4842-0980-6_13

13. Interceptors

Brent Watson 
(1)
316 Marine Ave, Brooklyn, USA
 
 
Brent Watson

Introduction to Interceptors

Stripes provides a facility to add hooks at various stages of your application. These are called Stripes interceptors. Interceptors are classes that implement Stripes’ Interceptor interface and contain an intercept() method. Interceptors are a great way to do things like log requests or build security into an application.
Interceptors use the same LifecycleStage enums used by the @Before and @After annotations that we saw in Chapter 11. Refer back to Table 11-1 for details on each life cycle stage.
Let’s jump right in (see Listing 13-1

Get Stripes by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.