use of org.springframework.web.context.request.ServletWebRequest in project spring-framework by spring-projects.
the class ModelMethodProcessorTests method setUp.
@Before
public void setUp() throws Exception {
processor = new ModelMethodProcessor();
mavContainer = new ModelAndViewContainer();
Method method = getClass().getDeclaredMethod("model", Model.class);
paramModel = new MethodParameter(method, 0);
returnParamModel = new MethodParameter(method, -1);
webRequest = new ServletWebRequest(new MockHttpServletRequest());
}
use of org.springframework.web.context.request.ServletWebRequest in project spring-framework by spring-projects.
the class RequestHeaderMethodArgumentResolverTests method setUp.
@Before
@SuppressWarnings("resource")
public void setUp() throws Exception {
GenericWebApplicationContext context = new GenericWebApplicationContext();
context.refresh();
resolver = new RequestHeaderMethodArgumentResolver(context.getBeanFactory());
Method method = ReflectionUtils.findMethod(getClass(), "params", (Class<?>[]) null);
paramNamedDefaultValueStringHeader = new SynthesizingMethodParameter(method, 0);
paramNamedValueStringArray = new SynthesizingMethodParameter(method, 1);
paramSystemProperty = new SynthesizingMethodParameter(method, 2);
paramContextPath = new SynthesizingMethodParameter(method, 3);
paramResolvedNameWithExpression = new SynthesizingMethodParameter(method, 4);
paramResolvedNameWithPlaceholder = new SynthesizingMethodParameter(method, 5);
paramNamedValueMap = new SynthesizingMethodParameter(method, 6);
paramDate = new SynthesizingMethodParameter(method, 7);
paramInstant = new SynthesizingMethodParameter(method, 8);
servletRequest = new MockHttpServletRequest();
webRequest = new ServletWebRequest(servletRequest, new MockHttpServletResponse());
// Expose request to the current thread (for SpEL expressions)
RequestContextHolder.setRequestAttributes(webRequest);
}
use of org.springframework.web.context.request.ServletWebRequest in project spring-framework by spring-projects.
the class RequestParamMapMethodArgumentResolverTests method setUp.
@Before
public void setUp() throws Exception {
resolver = new RequestParamMapMethodArgumentResolver();
request = new MockHttpServletRequest();
webRequest = new ServletWebRequest(request, new MockHttpServletResponse());
}
use of org.springframework.web.context.request.ServletWebRequest in project spring-framework by spring-projects.
the class ExpressionValueMethodArgumentResolverTests method setUp.
@Before
@SuppressWarnings("resource")
public void setUp() throws Exception {
GenericWebApplicationContext context = new GenericWebApplicationContext();
context.refresh();
resolver = new ExpressionValueMethodArgumentResolver(context.getBeanFactory());
Method method = getClass().getMethod("params", int.class, String.class, String.class);
paramSystemProperty = new MethodParameter(method, 0);
paramContextPath = new MethodParameter(method, 1);
paramNotSupported = new MethodParameter(method, 2);
webRequest = new ServletWebRequest(new MockHttpServletRequest(), new MockHttpServletResponse());
// Expose request to the current thread (for SpEL expressions)
RequestContextHolder.setRequestAttributes(webRequest);
}
use of org.springframework.web.context.request.ServletWebRequest in project spring-framework by spring-projects.
the class MapMethodProcessorTests method setUp.
@Before
public void setUp() throws Exception {
processor = new MapMethodProcessor();
mavContainer = new ModelAndViewContainer();
Method method = getClass().getDeclaredMethod("map", Map.class);
paramMap = new MethodParameter(method, 0);
returnParamMap = new MethodParameter(method, 0);
webRequest = new ServletWebRequest(new MockHttpServletRequest());
}
Aggregations