Posts

Showing posts with the label Understanding Interceptors

Understanding Interceptors

Interceptors allow you to define code to be executed before and/or after the execution of an Action method. (The "Filter" pattern.) There are many, many use cases for Interceptors, including validation, property population, security, logging, and profiling. Validation Examine input for correctness   Property Population Transfer and convert input to object properties Logging Journal details regarding each action Profiling Time action throughput, looking for performance bottlenecks Interceptors can be chained together to create an Interceptor "Stack". If an action neeeds to check the client's credentials, log the action, and time the action, all of these routines, and more, could be made part of the same Interceptor Stack. Interceptors are implemented as Java classes, so each Interceptor has a class name. To make it easier to reference Interceptors, each class can be registered with the framework and given a unique, simpler name. Indiv...