Java:从Apache Tiles 2 2.2.2迁移到Tiles 3 3.0.5

时间:2016-04-12 17:50:45

标签: java apache-tiles

我正在将旧的遗留应用程序移动到Tiles 3。 我无法在Tiles 2中找到任何有关Tiles 3中的等效信息或等价物的信息:

org.apache.tiles.TilesApplicationContext
org.apache.tiles.context.ChainedTilesRequestContextFactory
org.apache.tiles.context.TilesRequestContextFactory
org.apache.tiles.context.TilesRequestContext
org.apache.tiles.factory.TilesContainerFactory
org.apache.tiles.preparer.PreparerFactory
org.apache.tiles.reflect.ClassUtil
org.apache.tiles.renderer.AttributeRenderer
org.apache.tiles.renderer.impl.BasicRendererFactory
org.apache.tiles.jsp.context.JspUtil

有人能指出我正确的方向吗?

示例:

public static HttpServletRequest getRequest(TilesRequestContext tilesContext) {
    HttpServletRequest request = null;

    if (tilesContext != null) {
      Object[] requestObjects = tilesContext.getRequestObjects();
......
}
....
return request;
}

其中' TilesRequestContext'是 org.apache.tiles.context.TilesRequestContext; Tiles 3中不再提供哪些内容。 什么是Tiles 3中的等效替代品 http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tiles/tiles-core/2.1.2/org/apache/tiles/context/TilesRequestContext.java

谢谢,

奥列格

1 个答案:

答案 0 :(得分:-1)

TilesRequestContext可从TilesRequestContextHolder的getTilesRequestContext方法获得。

import org.apache.tiles.context.TilesRequestContextHolder;
    @Override
        public void execute(Request request, AttributeContext attrCntxt) {
            TilesRequestContextHolder tilesReqCtxHldr = new TilesRequestContextHolder();
            tilesReqCtxHldr.setTilesRequestContext(request);
            tilesReqCtxHldr.getTilesRequestContext(); //TilesRequestContext
        }