當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。