Search in sources :

Example 1 with ComponentEventRequestFilter

use of org.apache.tapestry5.services.ComponentEventRequestFilter in project tapestry-5 by apache.

the class TapestryModule method contributeComponentEventRequestHandler.

/**
 * Contributes filters:
 * <dl>
 * <dt>Ajax</dt>
 * <dd>Determines if the request is Ajax oriented, and redirects to an alternative handler if so</dd>
 * <dt>Secure</dt>
 * <dd>Sends a redirect if an non-secure request accesses a secure page</dd>
 * </dl>
 */
public void contributeComponentEventRequestHandler(OrderedConfiguration<ComponentEventRequestFilter> configuration, final RequestSecurityManager requestSecurityManager, @Ajax ComponentEventRequestHandler ajaxHandler) {
    ComponentEventRequestFilter secureFilter = new ComponentEventRequestFilter() {

        public void handle(ComponentEventRequestParameters parameters, ComponentEventRequestHandler handler) throws IOException {
            if (requestSecurityManager.checkForInsecureComponentEventRequest(parameters))
                return;
            handler.handle(parameters);
        }
    };
    configuration.add("Secure", secureFilter);
    configuration.add("Ajax", new AjaxFilter(request, ajaxHandler));
}
Also used : ComponentEventRequestFilter(org.apache.tapestry5.services.ComponentEventRequestFilter) ComponentEventRequestHandler(org.apache.tapestry5.services.ComponentEventRequestHandler) ComponentEventRequestParameters(org.apache.tapestry5.services.ComponentEventRequestParameters)

Aggregations

ComponentEventRequestFilter (org.apache.tapestry5.services.ComponentEventRequestFilter)1 ComponentEventRequestHandler (org.apache.tapestry5.services.ComponentEventRequestHandler)1 ComponentEventRequestParameters (org.apache.tapestry5.services.ComponentEventRequestParameters)1