org.springframework.web.servlet.support.JstlUtils Java Examples

The following examples show how to use org.springframework.web.servlet.support.JstlUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TilesView.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	Assert.state(this.renderer != null, "No Renderer set");

	exposeModelAsRequestAttributes(model, request);
	if (this.exposeJstlAttributes) {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
	if (this.alwaysInclude) {
		request.setAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME, true);
	}

	Request tilesRequest = createTilesRequest(request, response);
	this.renderer.render(getUrl(), tilesRequest);
}
 
Example #2
Source File: TilesView.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	Assert.state(this.renderer != null, "No Renderer set");

	exposeModelAsRequestAttributes(model, request);
	if (this.exposeJstlAttributes) {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
	if (this.alwaysInclude) {
		request.setAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME, true);
	}

	Request tilesRequest = createTilesRequest(request, response);
	this.renderer.render(getUrl(), tilesRequest);
}
 
Example #3
Source File: TilesView.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void renderMergedOutputModel(
		Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {

	ServletContext servletContext = getServletContext();
	TilesContainer container = ServletUtil.getContainer(servletContext);
	if (container == null) {
		throw new ServletException("Tiles container is not initialized. " +
				"Have you added a TilesConfigurer to your web application context?");
	}

	exposeModelAsRequestAttributes(model, request);
	JstlUtils.exposeLocalizationContext(new RequestContext(request, servletContext));
	if (this.alwaysInclude) {
		ServletUtil.setForceInclude(request, true);
	}
	container.render(getUrl(), request, response);
}
 
Example #4
Source File: TilesView.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
protected void renderMergedOutputModel(
		Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {

	ServletContext servletContext = getServletContext();
	TilesContainer container = ServletUtil.getContainer(servletContext);
	if (container == null) {
		throw new ServletException("Tiles container is not initialized. " +
				"Have you added a TilesConfigurer to your web application context?");
	}

	exposeModelAsRequestAttributes(model, request);
	JstlUtils.exposeLocalizationContext(new RequestContext(request, servletContext));
	if (this.alwaysInclude) {
		ServletUtil.setForceInclude(request, true);
	}
	container.render(getUrl(), request, response);
}
 
Example #5
Source File: JstlView.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Wraps the MessageSource with a JSTL-aware MessageSource that is aware
 * of JSTL's {@code javax.servlet.jsp.jstl.fmt.localizationContext}
 * context-param.
 * @see JstlUtils#getJstlAwareMessageSource
 */
@Override
protected void initServletContext(ServletContext servletContext) {
	if (this.messageSource != null) {
		this.messageSource = JstlUtils.getJstlAwareMessageSource(servletContext, this.messageSource);
	}
	super.initServletContext(servletContext);
}
 
Example #6
Source File: JstlView.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Exposes a JSTL LocalizationContext for Spring's locale and MessageSource.
 * @see JstlUtils#exposeLocalizationContext
 */
@Override
protected void exposeHelpers(HttpServletRequest request) throws Exception {
	if (this.messageSource != null) {
		JstlUtils.exposeLocalizationContext(request, this.messageSource);
	}
	else {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
}
 
Example #7
Source File: JstlView.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Wraps the MessageSource with a JSTL-aware MessageSource that is aware
 * of JSTL's {@code javax.servlet.jsp.jstl.fmt.localizationContext}
 * context-param.
 * @see JstlUtils#getJstlAwareMessageSource
 */
@Override
protected void initServletContext(ServletContext servletContext) {
	if (this.messageSource != null) {
		this.messageSource = JstlUtils.getJstlAwareMessageSource(servletContext, this.messageSource);
	}
	super.initServletContext(servletContext);
}
 
Example #8
Source File: JstlView.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Exposes a JSTL LocalizationContext for Spring's locale and MessageSource.
 * @see JstlUtils#exposeLocalizationContext
 */
@Override
protected void exposeHelpers(HttpServletRequest request) throws Exception {
	if (this.messageSource != null) {
		JstlUtils.exposeLocalizationContext(request, this.messageSource);
	}
	else {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
}
 
Example #9
Source File: TilesView.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	exposeModelAsRequestAttributes(model, request);
	if (this.exposeJstlAttributes) {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
	if (this.alwaysInclude) {
		request.setAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME, true);
	}

	Request tilesRequest = createTilesRequest(request, response);
	this.renderer.render(getUrl(), tilesRequest);
}
 
Example #10
Source File: JstlView.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Wraps the MessageSource with a JSTL-aware MessageSource that is aware
 * of JSTL's {@code javax.servlet.jsp.jstl.fmt.localizationContext}
 * context-param.
 * @see JstlUtils#getJstlAwareMessageSource
 */
@Override
protected void initServletContext(ServletContext servletContext) {
	if (this.messageSource != null) {
		this.messageSource = JstlUtils.getJstlAwareMessageSource(servletContext, this.messageSource);
	}
	super.initServletContext(servletContext);
}
 
Example #11
Source File: JstlView.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Exposes a JSTL LocalizationContext for Spring's locale and MessageSource.
 * @see JstlUtils#exposeLocalizationContext
 */
@Override
protected void exposeHelpers(HttpServletRequest request) throws Exception {
	if (this.messageSource != null) {
		JstlUtils.exposeLocalizationContext(request, this.messageSource);
	}
	else {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
}
 
Example #12
Source File: TilesView.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	exposeModelAsRequestAttributes(model, request);
	if (this.exposeJstlAttributes) {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
	if (this.alwaysInclude) {
		request.setAttribute(AbstractRequest.FORCE_INCLUDE_ATTRIBUTE_NAME, true);
	}

	Request tilesRequest = createTilesRequest(request, response);
	this.renderer.render(getUrl(), tilesRequest);
}
 
Example #13
Source File: JstlView.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Wraps the MessageSource with a JSTL-aware MessageSource that is aware
 * of JSTL's {@code javax.servlet.jsp.jstl.fmt.localizationContext}
 * context-param.
 * @see JstlUtils#getJstlAwareMessageSource
 */
@Override
protected void initServletContext(ServletContext servletContext) {
	if (this.messageSource != null) {
		this.messageSource = JstlUtils.getJstlAwareMessageSource(servletContext, this.messageSource);
	}
	super.initServletContext(servletContext);
}
 
Example #14
Source File: JstlView.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Exposes a JSTL LocalizationContext for Spring's locale and MessageSource.
 * @see JstlUtils#exposeLocalizationContext
 */
@Override
protected void exposeHelpers(HttpServletRequest request) throws Exception {
	if (this.messageSource != null) {
		JstlUtils.exposeLocalizationContext(request, this.messageSource);
	}
	else {
		JstlUtils.exposeLocalizationContext(new RequestContext(request, getServletContext()));
	}
}