org.springframework.web.context.support.ContextExposingHttpServletRequest Java Examples

The following examples show how to use org.springframework.web.context.support.ContextExposingHttpServletRequest. 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: AbstractView.java    From spring-analysis-note with MIT License 3 votes vote down vote up
/**
 * Get the request handle to expose to {@link #renderMergedOutputModel}, i.e. to the view.
 * <p>The default implementation wraps the original request for exposure of Spring beans
 * as request attributes (if demanded).
 * @param originalRequest the original servlet request as provided by the engine
 * @return the wrapped request, or the original request if no wrapping is necessary
 * @see #setExposeContextBeansAsAttributes
 * @see #setExposedContextBeanNames
 * @see org.springframework.web.context.support.ContextExposingHttpServletRequest
 */
protected HttpServletRequest getRequestToExpose(HttpServletRequest originalRequest) {
	if (this.exposeContextBeansAsAttributes || this.exposedContextBeanNames != null) {
		WebApplicationContext wac = getWebApplicationContext();
		Assert.state(wac != null, "No WebApplicationContext");
		return new ContextExposingHttpServletRequest(originalRequest, wac, this.exposedContextBeanNames);
	}
	return originalRequest;
}
 
Example #2
Source File: AbstractView.java    From java-technology-stack with MIT License 3 votes vote down vote up
/**
 * Get the request handle to expose to {@link #renderMergedOutputModel}, i.e. to the view.
 * <p>The default implementation wraps the original request for exposure of Spring beans
 * as request attributes (if demanded).
 * @param originalRequest the original servlet request as provided by the engine
 * @return the wrapped request, or the original request if no wrapping is necessary
 * @see #setExposeContextBeansAsAttributes
 * @see #setExposedContextBeanNames
 * @see org.springframework.web.context.support.ContextExposingHttpServletRequest
 */
protected HttpServletRequest getRequestToExpose(HttpServletRequest originalRequest) {
	if (this.exposeContextBeansAsAttributes || this.exposedContextBeanNames != null) {
		WebApplicationContext wac = getWebApplicationContext();
		Assert.state(wac != null, "No WebApplicationContext");
		return new ContextExposingHttpServletRequest(originalRequest, wac, this.exposedContextBeanNames);
	}
	return originalRequest;
}
 
Example #3
Source File: AbstractView.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Get the request handle to expose to {@link #renderMergedOutputModel}, i.e. to the view.
 * <p>The default implementation wraps the original request for exposure of Spring beans
 * as request attributes (if demanded).
 * @param originalRequest the original servlet request as provided by the engine
 * @return the wrapped request, or the original request if no wrapping is necessary
 * @see #setExposeContextBeansAsAttributes
 * @see #setExposedContextBeanNames
 * @see org.springframework.web.context.support.ContextExposingHttpServletRequest
 */
protected HttpServletRequest getRequestToExpose(HttpServletRequest originalRequest) {
	if (this.exposeContextBeansAsAttributes || this.exposedContextBeanNames != null) {
		return new ContextExposingHttpServletRequest(
				originalRequest, getWebApplicationContext(), this.exposedContextBeanNames);
	}
	return originalRequest;
}
 
Example #4
Source File: AbstractView.java    From spring4-understanding with Apache License 2.0 3 votes vote down vote up
/**
 * Get the request handle to expose to {@link #renderMergedOutputModel}, i.e. to the view.
 * <p>The default implementation wraps the original request for exposure of Spring beans
 * as request attributes (if demanded).
 * @param originalRequest the original servlet request as provided by the engine
 * @return the wrapped request, or the original request if no wrapping is necessary
 * @see #setExposeContextBeansAsAttributes
 * @see #setExposedContextBeanNames
 * @see org.springframework.web.context.support.ContextExposingHttpServletRequest
 */
protected HttpServletRequest getRequestToExpose(HttpServletRequest originalRequest) {
	if (this.exposeContextBeansAsAttributes || this.exposedContextBeanNames != null) {
		return new ContextExposingHttpServletRequest(
				originalRequest, getWebApplicationContext(), this.exposedContextBeanNames);
	}
	return originalRequest;
}