use of org.apache.tapestry5.services.ComponentEventRequestHandler in project tapestry-5 by apache.
the class AjaxFilter method handle.
public void handle(ComponentEventRequestParameters parameters, ComponentEventRequestHandler handler) throws IOException {
ComponentEventRequestHandler next = request.isXHR() ? ajaxHandler : handler;
next.handle(parameters);
}
use of org.apache.tapestry5.services.ComponentEventRequestHandler in project tapestry-5 by apache.
the class UploadExceptionFilter method handle.
@Override
public void handle(ComponentEventRequestParameters parameters, ComponentEventRequestHandler handler) throws IOException {
FileUploadException uploadException = decoder.getUploadException();
if (uploadException != null) {
Component page = componentSource.getPage(parameters.getActivePageName());
ComponentResultProcessorWrapper callback = new ComponentResultProcessorWrapper(resultProcessor);
page.getComponentResources().triggerEvent(UploadEvents.UPLOAD_EXCEPTION, new Object[] { uploadException }, callback);
if (callback.isAborted())
return;
throw new RuntimeException(UploadMessages.unableToDecode(), uploadException);
}
handler.handle(parameters);
}
use of org.apache.tapestry5.services.ComponentEventRequestHandler 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));
}
Aggregations