Search in sources :

Example 21 with ComponentEventRequestParameters

use of org.apache.tapestry5.services.ComponentEventRequestParameters 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

ComponentEventRequestParameters (org.apache.tapestry5.services.ComponentEventRequestParameters)13 Link (org.apache.tapestry5.http.Link)7 Page (org.apache.tapestry5.internal.structure.Page)7 Request (org.apache.tapestry5.http.services.Request)6 ComponentClassResolver (org.apache.tapestry5.services.ComponentClassResolver)6 LocalizationSetter (org.apache.tapestry5.services.LocalizationSetter)6 MetaDataLocator (org.apache.tapestry5.services.MetaDataLocator)6 Test (org.testng.annotations.Test)6 Response (org.apache.tapestry5.http.services.Response)5 Dispatcher (org.apache.tapestry5.http.services.Dispatcher)4 EmptyEventContext (org.apache.tapestry5.internal.EmptyEventContext)4 ComponentRequestHandler (org.apache.tapestry5.services.ComponentRequestHandler)4 ComponentEventLinkEncoder (org.apache.tapestry5.services.ComponentEventLinkEncoder)3 LinkCreationListener2 (org.apache.tapestry5.services.LinkCreationListener2)3 TrackableComponentEventCallback (org.apache.tapestry5.TrackableComponentEventCallback)2 TapestryException (org.apache.tapestry5.commons.internal.util.TapestryException)2 URLEventContext (org.apache.tapestry5.internal.URLEventContext)2 ComponentPageElement (org.apache.tapestry5.internal.structure.ComponentPageElement)2 ComponentEventRequestHandler (org.apache.tapestry5.services.ComponentEventRequestHandler)2 Locale (java.util.Locale)1