Examples of TurbineRunDataInternal


Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

            super("ContextValueResolver", context);
            this.name = name;
        }

        public Object resolve() {
            TurbineRunDataInternal rundata = (TurbineRunDataInternal) TurbineUtil.getTurbineRunData(request);
            Context turbineContext = rundata.getCurrentContext();

            if (turbineContext == null) {
                turbineContext = rundata.getContext(); // 默认取得screen context
            }

            Class<?> paramType = context.getTypeInfo().getRawType();
            Object value = turbineContext.get(name);
View Full Code Here

Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

            this.bufferedRequestContext.pushBuffer();

            try {
                controlParameterStack.addFirst(new ControlParameters()); // 支持control的嵌套

                TurbineRunDataInternal rundata = (TurbineRunDataInternal) TurbineUtil.getTurbineRunData(this.request);
                Context contextForControl = createContextForControl(params, componentName);

                rundata.pushContext(contextForControl, templateName);

                try {
                    if (controlModule != null) {
                        controlModule.execute();
                    }

                    // Control module可以通过注入ControlParameters接口来修改template。
                    String templateOverriden = rundata.getControlTemplate();

                    if (!isEquals(templateOverriden, templateName)) {
                        log.debug("Control template has been changed by module: " + templateName + " -> "
                                  + templateOverriden);

                        templateName = templateOverriden;
                    }

                    if (templateName != null) {
                        templateName = mappingRuleService.getMappedName(CONTROL_TEMPLATE, templateName);
                    }

                    if (templateName != null) {
                        templateService.writeTo(templateName, new ContextAdapter(contextForControl), rundata
                                .getResponse().getWriter());
                    }
                } finally {
                    rundata.popContext();
                }
            } finally {
                controlParameterStack.removeFirst();
                content = this.bufferedRequestContext.popCharBuffer();
            }
View Full Code Here

Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

        }
    }

    private Context createContextForControl(ControlParameters params, String componentName) {
        // get parent context
        TurbineRunDataInternal rundata = (TurbineRunDataInternal) TurbineUtil.getTurbineRunData(this.request);
        Context screenContext = rundata.getContext(componentName);
        final Context callerContext = rundata.getCurrentContext();
        final Set<String> exportVars = params.exportVars == null ? Collections.<String>emptySet() : params.exportVars;

        // create control context
        MappedContext context = new MappedContext(screenContext) {
            @Override
View Full Code Here

Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

    @Autowired
    private HttpServletRequest request;

    @Override
    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunDataInternal rundata = (TurbineRunDataInternal) getTurbineRunData(request);
        String target = rundata.getTarget();
        String redirectTarget = rundata.getRedirectTarget();

        if (!isEmpty(redirectTarget) && !isEquals(target, redirectTarget)) {
            rundata.setTarget(redirectTarget);
            rundata.setRedirectTarget(null);

            pipelineContext.invokeNext();
        } else {
            super.invoke(pipelineContext);
        }
View Full Code Here

Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

    @Autowired
    private MappingRuleService mappingRuleService;

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunDataInternal rundata = (TurbineRunDataInternal) getTurbineRunData(request);
        String target = assertNotNull(rundata.getTarget(), "Target was not specified");

        // 检查重定向标志,如果是重定向,则不需要将页面输出。
        if (!rundata.isRedirected()) {
            Context context = rundata.getContext();

            renderTemplate(getScreenTemplate(target), context, rundata);

            // layout可被禁用。
            if (rundata.isLayoutEnabled()) {
                String layoutTemplateOverride = rundata.getLayoutTemplateOverride();

                if (layoutTemplateOverride != null) {
                    target = layoutTemplateOverride;
                }
View Full Code Here

Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

        sorted.add(handler);
    }

    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunDataInternal rundata = (TurbineRunDataInternal) getTurbineRunData(request);
        ErrorHandlerHelper helper = ErrorHandlerHelper.getInstance(request);
        Throwable exception = helper.getException();

        // ģ���п��õ�helper
        rundata.getContext().put(helperName, helper);

        if (exception != null) {
            int statusCode = -1;
            String target = null;

            // ���������exception cause��ʼ����׷�ݣ����磺t1 caused by t2 caused by t3��
            // ��ô�����˳��Ϊt3, t2, t1��
            CAUSES: for (Throwable cause : getCauses(exception, true)) {
                // ����ÿ���쳣������ƥ���exception handlers��
                // ����handlers�Ѿ����򣬽�������쳣��ǰ������T1 extends T2����ôT1��T2֮ǰ��
                for (ExceptionHandler exceptionHandler : exceptionHandlers) {
                    if (exceptionHandler.getExceptionType().isInstance(cause)) {
                        statusCode = exceptionHandler.getStatusCode();
                        target = exceptionHandler.getPage();
                        break CAUSES;
                    }
                }
            }

            if (statusCode > 0) {
                rundata.getResponse().setStatus(statusCode);
                helper.setStatusCode(statusCode); // ����request attributes
            }

            if (target == null) {
                target = defaultPage;
            }

            rundata.setTarget(target);
        }

        // ִ����һ��Valve
        pipelineContext.invokeNext();
    }
View Full Code Here

Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

            super("ContextValueResolver", context);
            this.name = name;
        }

        public Object resolve() {
            TurbineRunDataInternal rundata = (TurbineRunDataInternal) TurbineUtil.getTurbineRunData(request);
            Context turbineContext = rundata.getCurrentContext();

            if (turbineContext == null) {
                turbineContext = rundata.getContext(); // Ĭ��ȡ��screen context
            }

            Class<?> paramType = context.getTypeInfo().getRawType();
            Object value = turbineContext.get(name);
View Full Code Here

Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

    @Autowired
    private HttpServletRequest request;

    @Override
    public void invoke(PipelineContext pipelineContext) throws Exception {
        TurbineRunDataInternal rundata = (TurbineRunDataInternal) getTurbineRunData(request);
        String target = rundata.getTarget();
        String redirectTarget = rundata.getRedirectTarget();

        if (!isEmpty(redirectTarget) && !isEquals(target, redirectTarget)) {
            rundata.setTarget(redirectTarget);
            rundata.setRedirectTarget(null);

            pipelineContext.invokeNext();
        } else {
            super.invoke(pipelineContext);
        }
View Full Code Here

Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

            this.bufferedRequestContext.pushBuffer();

            try {
                controlParameterStack.addFirst(new ControlParameters()); // ֧��control��Ƕ��

                TurbineRunDataInternal rundata = (TurbineRunDataInternal) TurbineUtil.getTurbineRunData(this.request);
                Context contextForControl = createContextForControl(params, componentName);

                rundata.pushContext(contextForControl, templateName);

                try {
                    if (controlModule != null) {
                        controlModule.execute();
                    }

                    // Control module����ͨ��ע��ControlParameters�ӿ����޸�template��
                    String templateOverriden = rundata.getControlTemplate();

                    if (!isEquals(templateOverriden, templateName)) {
                        log.debug("Control template has been changed by module: " + templateName + " -> "
                                + templateOverriden);

                        templateName = templateOverriden;
                    }

                    if (templateName != null) {
                        templateName = mappingRuleService.getMappedName(CONTROL_TEMPLATE, templateName);
                    }

                    if (templateName != null) {
                        templateService.writeTo(templateName, new ContextAdapter(contextForControl), rundata
                                .getResponse().getWriter());
                    }
                } finally {
                    rundata.popContext();
                }
            } finally {
                controlParameterStack.removeFirst();
                content = this.bufferedRequestContext.popCharBuffer();
            }
View Full Code Here

Examples of com.alibaba.citrus.turbine.TurbineRunDataInternal

        }
    }

    private Context createContextForControl(ControlParameters params, String componentName) {
        // get parent context
        TurbineRunDataInternal rundata = (TurbineRunDataInternal) TurbineUtil.getTurbineRunData(this.request);
        Context screenContext = rundata.getContext(componentName);
        final Context callerContext = rundata.getCurrentContext();
        final Set<String> exportVars = params.exportVars == null ? Collections.<String> emptySet() : params.exportVars;

        // create control context
        MappedContext context = new MappedContext(screenContext) {
            @Override
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.