⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example11tapestryengine.java

📁 典型实用的利用tapstry、spring、hibernate、框架的实例
💻 JAVA
字号:
/*
 * Created on 2004-10-31
 * 
 * http://www.open-v.com 提供代码的维护工作
 */
package com.openv.spring.tapestry;

import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.engine.BaseEngine;
import org.apache.tapestry.request.RequestContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

/**
 * Example11 Tapestry引擎
 * 
 * @author luoshifei
 */
public class Example11TapestryEngine extends BaseEngine {
    private static final Log log = LogFactory
            .getLog(Example11TapestryEngine.class);

    public static final String APPLICATION_CONTEXT_KEY = "appContext";

    public Example11TapestryEngine() {
        log.info("Create a Example11TapestryEngine Engine Instance.");
    }

    /**
     * 通过Spring提供的WebApplicationContextUtils, 将ApplicationContext放置到Tapestry中。
     */
    protected void setupForRequest(RequestContext context) {
        super.setupForRequest(context);

        Map global = (Map) getGlobal();
        ApplicationContext ac = (ApplicationContext) global
                .get(APPLICATION_CONTEXT_KEY);
        if (ac == null) {
            ac = WebApplicationContextUtils.getWebApplicationContext(context
                    .getServlet().getServletContext());
            global.put(APPLICATION_CONTEXT_KEY, ac);
        }
    }

    /**
     * 完成页面清理工作
     */
    protected void cleanupAfterRequest(IRequestCycle cycle) {
        super.cleanupAfterRequest(cycle);
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -