本文整理汇总了Java中org.apache.tiles.request.servlet.ServletUtil类的典型用法代码示例。如果您正苦于以下问题:Java ServletUtil类的具体用法?Java ServletUtil怎么用?Java ServletUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServletUtil类属于org.apache.tiles.request.servlet包,在下文中一共展示了ServletUtil类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simpleBootstrap
import org.apache.tiles.request.servlet.ServletUtil; //导入依赖的package包/类
@Test
public void simpleBootstrap() {
MockServletContext servletContext = new MockServletContext();
TilesConfigurer tc = new TilesConfigurer();
tc.setDefinitions("/org/springframework/web/servlet/view/tiles3/tiles-definitions.xml");
tc.setCheckRefresh(true);
tc.setServletContext(servletContext);
tc.afterPropertiesSet();
ApplicationContext tilesContext = ServletUtil.getApplicationContext(servletContext);
BasicTilesContainer container = (BasicTilesContainer) TilesAccess.getContainer(tilesContext);
Request requestContext = new ServletRequest(container.getApplicationContext(),
new MockHttpServletRequest(), new MockHttpServletResponse());
assertNotNull(container.getDefinitionsFactory().getDefinition("test", requestContext));
tc.destroy();
}
示例2: afterPropertiesSet
import org.apache.tiles.request.servlet.ServletUtil; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
this.applicationContext = ServletUtil.getApplicationContext(getServletContext());
if (this.renderer == null) {
TilesContainer container = TilesAccess.getContainer(this.applicationContext);
this.renderer = new DefinitionRenderer(container);
}
}
示例3: resolveLocale
import org.apache.tiles.request.servlet.ServletUtil; //导入依赖的package包/类
@Override
public Locale resolveLocale(Request request) {
try {
HttpServletRequest servletRequest = ServletUtil.getServletRequest(request).getRequest();
if (servletRequest != null) {
return RequestContextUtils.getLocale(servletRequest);
}
}
catch (NotAServletEnvironmentException e) {
// Ignore
}
return super.resolveLocale(request);
}
示例4: render
import org.apache.tiles.request.servlet.ServletUtil; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void render(final String location, final HttpServletRequest request,
final HttpServletResponse response,
final ServletContext servletContext, final Locale locale,
final ValueStack valueStack, final Object action) {
ApplicationContext applicationContext = ServletUtil
.getApplicationContext(servletContext);
TilesContainer container = TilesAccess.getContainer(applicationContext);
ServletRequest servletRequest = new ServletRequest(applicationContext,
request, response);
container.render(location, servletRequest);
}
示例5: afterPropertiesSet
import org.apache.tiles.request.servlet.ServletUtil; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
this.applicationContext = ServletUtil.getApplicationContext(getServletContext());
if (this.renderer == null) {
TilesContainer container = TilesAccess.getContainer(this.applicationContext);
this.renderer = new DefinitionRenderer(container);
}
}