Java Code Examples for org.springframework.mock.web.mockhttpservletrequest#getServletContext()

The following examples show how to use org.springframework.mock.web.mockhttpservletrequest#getServletContext() . 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: MockHttpServletRequestBuilder.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private FlashMapManager getFlashMapManager(MockHttpServletRequest request) {
	FlashMapManager flashMapManager = null;
	try {
		ServletContext servletContext = request.getServletContext();
		WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
		flashMapManager = wac.getBean(DispatcherServlet.FLASH_MAP_MANAGER_BEAN_NAME, FlashMapManager.class);
	}
	catch (IllegalStateException | NoSuchBeanDefinitionException ex) {
		// ignore
	}
	return (flashMapManager != null ? flashMapManager : new SessionFlashMapManager());
}
 
Example 2
Source File: MockHttpServletRequestBuilder.java    From java-technology-stack with MIT License 5 votes vote down vote up
private FlashMapManager getFlashMapManager(MockHttpServletRequest request) {
	FlashMapManager flashMapManager = null;
	try {
		ServletContext servletContext = request.getServletContext();
		WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
		flashMapManager = wac.getBean(DispatcherServlet.FLASH_MAP_MANAGER_BEAN_NAME, FlashMapManager.class);
	}
	catch (IllegalStateException | NoSuchBeanDefinitionException ex) {
		// ignore
	}
	return (flashMapManager != null ? flashMapManager : new SessionFlashMapManager());
}
 
Example 3
Source File: HtmlUnitRequestBuilder.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public HtmlUnitMockHttpSession(MockHttpServletRequest request) {
	super(request.getServletContext());
	this.request = request;
}
 
Example 4
Source File: HtmlUnitRequestBuilder.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private HtmlUnitMockHttpSession(MockHttpServletRequest request, String id) {
	super(request.getServletContext(), id);
	this.request = request;
}
 
Example 5
Source File: HtmlUnitRequestBuilder.java    From java-technology-stack with MIT License 4 votes vote down vote up
public HtmlUnitMockHttpSession(MockHttpServletRequest request) {
	super(request.getServletContext());
	this.request = request;
}
 
Example 6
Source File: HtmlUnitRequestBuilder.java    From java-technology-stack with MIT License 4 votes vote down vote up
private HtmlUnitMockHttpSession(MockHttpServletRequest request, String id) {
	super(request.getServletContext(), id);
	this.request = request;
}
 
Example 7
Source File: HtmlUnitRequestBuilder.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private HtmlUnitMockHttpSession(MockHttpServletRequest request) {
	super(request.getServletContext());
	this.request = request;
}
 
Example 8
Source File: HtmlUnitRequestBuilder.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private HtmlUnitMockHttpSession(MockHttpServletRequest request, String id) {
	super(request.getServletContext(), id);
	this.request = request;
}