webx-component-and-root.xml 4.73 KB
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xmlns:services="http://www.alibaba.com/schema/services"
             xmlns:dr-factories="http://www.alibaba.com/schema/services/data-resolver/factories"
             xmlns:mapping-rules="http://www.alibaba.com/schema/services/mapping-rules"
             xmlns:tpl-engines="http://www.alibaba.com/schema/services/template/engines"
             xmlns:vm-plugins="http://www.alibaba.com/schema/services/template/engines/velocity/plugins"
             xsi:schemaLocation="http://www.alibaba.com/schema/services http://localhost:8080/schema/services.xsd
                 http://www.alibaba.com/schema/services/data-resolver/factories http://localhost:8080/schema/services-data-resolver-factories.xsd
                 http://www.alibaba.com/schema/services/mapping-rules http://localhost:8080/schema/services-mapping-rules.xsd
                 http://www.alibaba.com/schema/services/template/engines http://localhost:8080/schema/services-template-engines.xsd

                 http://www.alibaba.com/schema/services/template/engines/velocity/plugins http://localhost:8080/schema/services-template-engines-velocity-plugins.xsd
                 http://www.springframework.org/schema/beans http://localhost:8080/schema/www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- 此文件被 webx.xml 和 webx-*.xml 同时引用。 -->
    <!-- 注意:此文件需要property-placeholder变量:${component}。 -->

    <!-- Template渲染服务。 -->
    <services:template searchExtensions="true">
        <tpl-engines:velocity-engine templateEncoding="UTF-8" strictReference="false" path="/${component}/templates">
            <global-macros>
                <name>global/*.vm</name>
            </global-macros>
            <plugins>
                <vm-plugins:escape-support defaultEscape="html">
                    <noescape>
                        <if-matches pattern="^control\." />
                        <if-matches pattern="^screen_placeholder" />
                        <if-matches pattern="^stringEscapeUtil\.escape" />
                        <if-matches pattern="^csrfToken\.(get)?(\w*)hiddenField" />
                    </noescape>
                </vm-plugins:escape-support>
            </plugins>
        </tpl-engines:velocity-engine>
        <tpl-engines:freemarker-engine templateEncoding="UTF-8" path="/${component}/templates" />
        <tpl-engines:jsp-engine path="/${component}/templates" />
    </services:template>

    <!-- 名称查找规则。 -->
    <services:mapping-rules>

        <!-- External target name => Internal target name -->
        <mapping-rules:extension-rule id="extension.input">
            <!-- 默认后缀 -->
            <mapping extension="" to="" />

            <!-- Velocity -->
            <mapping extension="htm" to="" />
            <mapping extension="vm" to="" />
        </mapping-rules:extension-rule>

        <!-- Internal target name => External target name -->
        <mapping-rules:extension-rule id="extension.output">
            <!-- 默认后缀 -->
            <mapping extension="" to="htm" />

            <!-- Velocity -->
            <mapping extension="htm" to="htm" />
            <mapping extension="vm" to="htm" />
        </mapping-rules:extension-rule>

        <!-- Target name => Action module name -->
        <mapping-rules:direct-module-rule id="action" />

        <!-- Target name => Screen module name (*.do) -->
        <mapping-rules:direct-module-rule id="screen.notemplate" />

        <!-- Target name => Screen module name (*.jsp, *.vm) -->
        <mapping-rules:fallback-module-rule id="screen" moduleType="screen" />

        <!-- Target name => Screen template name -->
        <mapping-rules:direct-template-rule id="screen.template" templatePrefix="screen" />

        <!-- Target name => Layout template name -->
        <mapping-rules:fallback-template-rule id="layout.template" templatePrefix="layout" />

        <!-- Target name => Control module name (setControl method) -->
        <mapping-rules:direct-module-rule id="control.notemplate" />

        <!-- Target name => Control module name (setTemplate method) -->
        <mapping-rules:fallback-module-rule id="control" moduleType="control" />

        <!-- Target name => Control template name -->
        <mapping-rules:direct-template-rule id="control.template" templatePrefix="control" />

    </services:mapping-rules>

    <!-- 支持注入参数。 -->
    <services:data-resolver>
        <dr-factories:turbine-rundata-resolver />
        <dr-factories:parameter-resolver />
        <!--<dr-factories:form-resolver />-->
    </services:data-resolver>

</beans:beans>