Package com.alibaba.citrus.turbine.util

Examples of com.alibaba.citrus.turbine.util.ControlTool


        String template = trimToNull(subst.substitute(templateName));
        String module = trimToNull(subst.substitute(moduleName));

        Context context = rundata.getContext();
        ControlTool controlTool = getControlTool(context, template, module, rundata);

        // render control
        rundata.getResponse().getWriter(); // 必须先预备好buffer
        String content = controlTool.render();

        // 设置context,以便后续模块能够读取
        context.put("controlContent", content); // controlContent为control渲染的结果
        context.put("controlTarget", template != null ? template : module);
View Full Code Here


        String toolName = controlToolName;
        Object tool = context.get(toolName);

        assertTrue(tool instanceof ControlTool, "no control tool: %s", toolName);

        ControlTool controlTool = (ControlTool) tool;

        // setTemplate or setModule
        if (template != null) {
            controlTool.setTemplate(template);
        } else if (module != null) {
            controlTool.setModule(module);
        }

        // setParameter
        ParameterParser params = rundata.getParameters();

        for (String key : params.keySet()) {
            Object[] values = params.getObjects(key);

            switch (values.length) {
                case 0:
                    break;

                case 1:
                    controlTool.setParameter(key, values[0]);
                    break;

                default:
                    controlTool.setParameter(key, values);
                    break;
            }
        }

        return controlTool;
View Full Code Here

        String template = trimToNull(subst.substitute(templateName));
        String module = trimToNull(subst.substitute(moduleName));

        Context context = rundata.getContext();
        ControlTool controlTool = getControlTool(context, template, module, rundata);

        // render control
        rundata.getResponse().getWriter(); // ������Ԥ����buffer
        String content = controlTool.render();

        // ����context���Ա����ģ���ܹ���ȡ
        context.put("controlContent", content); // controlContentΪcontrol��Ⱦ�Ľ��
        context.put("controlTarget", template != null ? template : module);
View Full Code Here

        String toolName = controlToolName;
        Object tool = context.get(toolName);

        assertTrue(tool instanceof ControlTool, "no control tool: %s", toolName);

        ControlTool controlTool = (ControlTool) tool;

        // setTemplate or setModule
        if (template != null) {
            controlTool.setTemplate(template);
        } else if (module != null) {
            controlTool.setModule(module);
        }

        // setParameter
        ParameterParser params = rundata.getParameters();

        for (String key : params.keySet()) {
            Object[] values = params.getObjects(key);

            switch (values.length) {
                case 0:
                    break;

                case 1:
                    controlTool.setParameter(key, values[0]);
                    break;

                default:
                    controlTool.setParameter(key, values);
                    break;
            }
        }

        return controlTool;
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.turbine.util.ControlTool

Copyright © 2018 www.massapicom. 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.