Documentation

You are viewing the documentation for the 2.5.0-RC1 development release. The latest stable release series is 3.0.x.

§Intercepting requests

NOTE: The GlobalSettings class is deprecated in 2.5.x. Please see the Removing `GlobalSettings` page for how to migrate away from GlobalSettings.

§Overriding onRequest

One important aspect of the GlobalSettings class is that it provides a way to intercept requests and execute business logic before a request is dispatched to an action.

For example:

public class Global extends GlobalSettings {

    public Action onRequest(Http.Request request, Method actionMethod) {
        System.out.println("before each request..." + request.toString());
        return super.onRequest(request, actionMethod);
    }

}

It’s also possible to intercept a specific action method. This can be achieved via Action composition.

Next: Testing your application