Search in sources :

Example 1 with TargetableInterceptor

use of com.github.bordertech.wcomponents.container.TargetableInterceptor in project wcomponents by BorderTech.

the class ServletUtil method createInterceptorChain.

/**
 * Creates a new interceptor chain to handle the given request.
 *
 * @param request the request to handle
 * @return a new interceptor chain for the request.
 */
public static InterceptorComponent createInterceptorChain(final HttpServletRequest request) {
    // Allow for multi part parameters
    Map<String, String[]> parameters = getRequestParameters(request);
    InterceptorComponent[] chain;
    if (parameters.get(WServlet.DATA_LIST_PARAM_NAME) != null) {
        // Datalist
        chain = new InterceptorComponent[] { new TransformXMLInterceptor(), new DataListInterceptor() };
    } else if (parameters.get(WServlet.AJAX_TRIGGER_PARAM_NAME) != null) {
        // AJAX
        chain = new InterceptorComponent[] { new TemplateRenderInterceptor(), new TransformXMLInterceptor(), new ValidateXMLInterceptor(), new AjaxErrorInterceptor(), new SessionTokenAjaxInterceptor(), new ResponseCacheInterceptor(CacheType.NO_CACHE), new UIContextDumpInterceptor(), new AjaxSetupInterceptor(), new WWindowInterceptor(true), new WrongStepAjaxInterceptor(), new ContextCleanupInterceptor(), new WhitespaceFilterInterceptor(), new SubordinateControlInterceptor(), new AjaxPageShellInterceptor(), new AjaxDebugStructureInterceptor(), new AjaxInterceptor() };
    } else if (parameters.get(WServlet.TARGET_ID_PARAM_NAME) != null) {
        // Targetted Content
        chain = new InterceptorComponent[] { new TargetableErrorInterceptor(), new SessionTokenContentInterceptor(), new UIContextDumpInterceptor(), new TargetableInterceptor(), new WWindowInterceptor(false), new WrongStepContentInterceptor() };
    } else {
        chain = new InterceptorComponent[] { // Page submit
        new TemplateRenderInterceptor(), new TransformXMLInterceptor(), new ValidateXMLInterceptor(), new SessionTokenInterceptor(), new ResponseCacheInterceptor(CacheType.NO_CACHE), new UIContextDumpInterceptor(), new WWindowInterceptor(true), new WrongStepServerInterceptor(), new AjaxCleanupInterceptor(), new ContextCleanupInterceptor(), new WhitespaceFilterInterceptor(), new SubordinateControlInterceptor(), new PageShellInterceptor(), new FormInterceptor(), new DebugStructureInterceptor() };
    }
    // Link the interceptors together in a chain.
    for (int i = 0; i < chain.length - 1; i++) {
        chain[i].setBackingComponent(chain[i + 1]);
    }
    // Return the top of the chain.
    return chain[0];
}
Also used : AjaxCleanupInterceptor(com.github.bordertech.wcomponents.container.AjaxCleanupInterceptor) WrongStepAjaxInterceptor(com.github.bordertech.wcomponents.container.WrongStepAjaxInterceptor) AjaxPageShellInterceptor(com.github.bordertech.wcomponents.container.AjaxPageShellInterceptor) InterceptorComponent(com.github.bordertech.wcomponents.container.InterceptorComponent) AjaxErrorInterceptor(com.github.bordertech.wcomponents.container.AjaxErrorInterceptor) AjaxDebugStructureInterceptor(com.github.bordertech.wcomponents.container.AjaxDebugStructureInterceptor) WrongStepAjaxInterceptor(com.github.bordertech.wcomponents.container.WrongStepAjaxInterceptor) SessionTokenAjaxInterceptor(com.github.bordertech.wcomponents.container.SessionTokenAjaxInterceptor) AjaxInterceptor(com.github.bordertech.wcomponents.container.AjaxInterceptor) SessionTokenContentInterceptor(com.github.bordertech.wcomponents.container.SessionTokenContentInterceptor) TemplateRenderInterceptor(com.github.bordertech.wcomponents.container.TemplateRenderInterceptor) WrongStepContentInterceptor(com.github.bordertech.wcomponents.container.WrongStepContentInterceptor) AjaxSetupInterceptor(com.github.bordertech.wcomponents.container.AjaxSetupInterceptor) AjaxDebugStructureInterceptor(com.github.bordertech.wcomponents.container.AjaxDebugStructureInterceptor) DebugStructureInterceptor(com.github.bordertech.wcomponents.container.DebugStructureInterceptor) UIContextDumpInterceptor(com.github.bordertech.wcomponents.container.UIContextDumpInterceptor) TargetableErrorInterceptor(com.github.bordertech.wcomponents.container.TargetableErrorInterceptor) WhitespaceFilterInterceptor(com.github.bordertech.wcomponents.container.WhitespaceFilterInterceptor) FormInterceptor(com.github.bordertech.wcomponents.container.FormInterceptor) DataListInterceptor(com.github.bordertech.wcomponents.container.DataListInterceptor) TargetableInterceptor(com.github.bordertech.wcomponents.container.TargetableInterceptor) SessionTokenAjaxInterceptor(com.github.bordertech.wcomponents.container.SessionTokenAjaxInterceptor) ValidateXMLInterceptor(com.github.bordertech.wcomponents.container.ValidateXMLInterceptor) SessionTokenInterceptor(com.github.bordertech.wcomponents.container.SessionTokenInterceptor) WWindowInterceptor(com.github.bordertech.wcomponents.container.WWindowInterceptor) ResponseCacheInterceptor(com.github.bordertech.wcomponents.container.ResponseCacheInterceptor) TransformXMLInterceptor(com.github.bordertech.wcomponents.container.TransformXMLInterceptor) ContextCleanupInterceptor(com.github.bordertech.wcomponents.container.ContextCleanupInterceptor) SubordinateControlInterceptor(com.github.bordertech.wcomponents.container.SubordinateControlInterceptor) PageShellInterceptor(com.github.bordertech.wcomponents.container.PageShellInterceptor) AjaxPageShellInterceptor(com.github.bordertech.wcomponents.container.AjaxPageShellInterceptor) WrongStepServerInterceptor(com.github.bordertech.wcomponents.container.WrongStepServerInterceptor)

Aggregations

AjaxCleanupInterceptor (com.github.bordertech.wcomponents.container.AjaxCleanupInterceptor)1 AjaxDebugStructureInterceptor (com.github.bordertech.wcomponents.container.AjaxDebugStructureInterceptor)1 AjaxErrorInterceptor (com.github.bordertech.wcomponents.container.AjaxErrorInterceptor)1 AjaxInterceptor (com.github.bordertech.wcomponents.container.AjaxInterceptor)1 AjaxPageShellInterceptor (com.github.bordertech.wcomponents.container.AjaxPageShellInterceptor)1 AjaxSetupInterceptor (com.github.bordertech.wcomponents.container.AjaxSetupInterceptor)1 ContextCleanupInterceptor (com.github.bordertech.wcomponents.container.ContextCleanupInterceptor)1 DataListInterceptor (com.github.bordertech.wcomponents.container.DataListInterceptor)1 DebugStructureInterceptor (com.github.bordertech.wcomponents.container.DebugStructureInterceptor)1 FormInterceptor (com.github.bordertech.wcomponents.container.FormInterceptor)1 InterceptorComponent (com.github.bordertech.wcomponents.container.InterceptorComponent)1 PageShellInterceptor (com.github.bordertech.wcomponents.container.PageShellInterceptor)1 ResponseCacheInterceptor (com.github.bordertech.wcomponents.container.ResponseCacheInterceptor)1 SessionTokenAjaxInterceptor (com.github.bordertech.wcomponents.container.SessionTokenAjaxInterceptor)1 SessionTokenContentInterceptor (com.github.bordertech.wcomponents.container.SessionTokenContentInterceptor)1 SessionTokenInterceptor (com.github.bordertech.wcomponents.container.SessionTokenInterceptor)1 SubordinateControlInterceptor (com.github.bordertech.wcomponents.container.SubordinateControlInterceptor)1 TargetableErrorInterceptor (com.github.bordertech.wcomponents.container.TargetableErrorInterceptor)1 TargetableInterceptor (com.github.bordertech.wcomponents.container.TargetableInterceptor)1 TemplateRenderInterceptor (com.github.bordertech.wcomponents.container.TemplateRenderInterceptor)1