example11tapestryengine.java
来自「典型实用的利用tapstry、spring、hibernate、框架的实例」· Java 代码 · 共 56 行
JAVA
56 行
/*
* 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 + =
减小字号Ctrl + -
显示快捷键?