当前位置: 首页>>代码示例>>Java>>正文


Java ServletRequest类代码示例

本文整理汇总了Java中org.apache.tiles.request.servlet.ServletRequest的典型用法代码示例。如果您正苦于以下问题:Java ServletRequest类的具体用法?Java ServletRequest怎么用?Java ServletRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServletRequest类属于org.apache.tiles.request.servlet包,在下文中一共展示了ServletRequest类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: simpleBootstrap

import org.apache.tiles.request.servlet.ServletRequest; //导入依赖的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();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:TilesConfigurerTests.java

示例2: checkResource

import org.apache.tiles.request.servlet.ServletRequest; //导入依赖的package包/类
@Override
public boolean checkResource(final Locale locale) throws Exception {
	HttpServletRequest servletRequest = null;
	RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
	if (requestAttributes instanceof ServletRequestAttributes) {
		servletRequest = ((ServletRequestAttributes) requestAttributes).getRequest();
	}
	Request request = new ServletRequest(this.applicationContext, servletRequest, null) {
		@Override
		public Locale getRequestLocale() {
			return locale;
		}
	};
	return this.renderer.isRenderable(getUrl(), request);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:16,代码来源:TilesView.java

示例3: createTilesRequest

import org.apache.tiles.request.servlet.ServletRequest; //导入依赖的package包/类
/**
 * Create a Tiles {@link Request}.
 * <p>This implementation creates a {@link ServletRequest}.
 * @param request the current request
 * @param response the current response
 * @return the Tiles request
 */
protected Request createTilesRequest(final HttpServletRequest request, HttpServletResponse response) {
	return new ServletRequest(this.applicationContext, request, response) {
		@Override
		public Locale getRequestLocale() {
			return RequestContextUtils.getLocale(request);
		}
	};
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:16,代码来源:TilesView.java

示例4: render

import org.apache.tiles.request.servlet.ServletRequest; //导入依赖的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);
}
 
开发者ID:aleksandr-m,项目名称:struts2-pdfstream,代码行数:14,代码来源:TilesRenderer.java

示例5: checkResource

import org.apache.tiles.request.servlet.ServletRequest; //导入依赖的package包/类
@Override
public boolean checkResource(final Locale locale) throws Exception {
	HttpServletRequest servletRequest = null;
	RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
	if(requestAttributes != null && requestAttributes instanceof ServletRequestAttributes) {
		servletRequest = ((ServletRequestAttributes)requestAttributes).getRequest();
	}
	Request request = new ServletRequest(this.applicationContext, servletRequest, null) {
		@Override
		public Locale getRequestLocale() {
			return locale;
		}
	};
	return this.renderer.isRenderable(getUrl(), request);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:16,代码来源:TilesView.java

示例6: createTilesRequest

import org.apache.tiles.request.servlet.ServletRequest; //导入依赖的package包/类
/**
 * Create a Tiles {@link Request}. This implementation creates a
 * {@link ServletRequest}.
 *
 * @param request the current request
 * @param response the current response
 * @return the Tiles request
 */
protected Request createTilesRequest(final HttpServletRequest request, HttpServletResponse response) {
	return new ServletRequest(this.applicationContext, request, response) {
		@Override
		public Locale getRequestLocale() {
			return RequestContextUtils.getLocale(request);
		}
	};
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:17,代码来源:TilesView.java


注:本文中的org.apache.tiles.request.servlet.ServletRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。