Java Code Examples for org.springframework.mock.web.test.MockPageContext#getRequest()
The following examples show how to use
org.springframework.mock.web.test.MockPageContext#getRequest() .
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: ErrorsTagTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected void exposeBindingResult(Errors errors) { // wrap errors in a Model Map model = new HashMap(); model.put(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors); // replace the request context with one containing the errors MockPageContext pageContext = getPageContext(); RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context); }
Example 2
Source File: AbstractHtmlElementTagTests.java From spring-analysis-note with MIT License | 5 votes |
protected MockPageContext createAndPopulatePageContext() throws JspException { MockPageContext pageContext = createPageContext(); MockHttpServletRequest request = (MockHttpServletRequest) pageContext.getRequest(); ((StaticWebApplicationContext) RequestContextUtils.findWebApplicationContext(request)) .registerSingleton("requestDataValueProcessor", RequestDataValueProcessorWrapper.class); extendRequest(request); extendPageContext(pageContext); RequestContext requestContext = new JspAwareRequestContext(pageContext); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, requestContext); return pageContext; }
Example 3
Source File: AbstractHtmlElementTagTests.java From spring-analysis-note with MIT License | 5 votes |
protected void exposeBindingResult(Errors errors) { // wrap errors in a Model Map<String, Object> model = Collections.singletonMap( BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors); // replace the request context with one containing the errors MockPageContext pageContext = getPageContext(); RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context); }
Example 4
Source File: OptionsTagTests.java From spring-analysis-note with MIT License | 5 votes |
@Override protected void exposeBindingResult(Errors errors) { // wrap errors in a Model Map model = new HashMap(); model.put(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors); // replace the request context with one containing the errors MockPageContext pageContext = getPageContext(); RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context); }
Example 5
Source File: ErrorsTagTests.java From java-technology-stack with MIT License | 5 votes |
@Override protected void exposeBindingResult(Errors errors) { // wrap errors in a Model Map model = new HashMap(); model.put(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors); // replace the request context with one containing the errors MockPageContext pageContext = getPageContext(); RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context); }
Example 6
Source File: AbstractHtmlElementTagTests.java From java-technology-stack with MIT License | 5 votes |
protected MockPageContext createAndPopulatePageContext() throws JspException { MockPageContext pageContext = createPageContext(); MockHttpServletRequest request = (MockHttpServletRequest) pageContext.getRequest(); ((StaticWebApplicationContext) RequestContextUtils.findWebApplicationContext(request)) .registerSingleton("requestDataValueProcessor", RequestDataValueProcessorWrapper.class); extendRequest(request); extendPageContext(pageContext); RequestContext requestContext = new JspAwareRequestContext(pageContext); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, requestContext); return pageContext; }
Example 7
Source File: AbstractHtmlElementTagTests.java From java-technology-stack with MIT License | 5 votes |
protected void exposeBindingResult(Errors errors) { // wrap errors in a Model Map<String, Object> model = Collections.singletonMap( BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors); // replace the request context with one containing the errors MockPageContext pageContext = getPageContext(); RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context); }
Example 8
Source File: OptionsTagTests.java From java-technology-stack with MIT License | 5 votes |
@Override protected void exposeBindingResult(Errors errors) { // wrap errors in a Model Map model = new HashMap(); model.put(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors); // replace the request context with one containing the errors MockPageContext pageContext = getPageContext(); RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context); }
Example 9
Source File: ErrorsTagTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override protected void exposeBindingResult(Errors errors) { // wrap errors in a Model Map model = new HashMap(); model.put(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors); // replace the request context with one containing the errors MockPageContext pageContext = getPageContext(); RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context); }
Example 10
Source File: AbstractHtmlElementTagTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
protected MockPageContext createAndPopulatePageContext() throws JspException { MockPageContext pageContext = createPageContext(); MockHttpServletRequest request = (MockHttpServletRequest) pageContext.getRequest(); StaticWebApplicationContext wac = (StaticWebApplicationContext) RequestContextUtils.findWebApplicationContext(request); wac.registerSingleton("requestDataValueProcessor", RequestDataValueProcessorWrapper.class); extendRequest(request); extendPageContext(pageContext); RequestContext requestContext = new JspAwareRequestContext(pageContext); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, requestContext); return pageContext; }
Example 11
Source File: AbstractHtmlElementTagTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
protected void exposeBindingResult(Errors errors) { // wrap errors in a Model Map<String, Object> model = Collections.singletonMap( BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors); // replace the request context with one containing the errors MockPageContext pageContext = getPageContext(); RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context); }
Example 12
Source File: OptionsTagTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override protected void exposeBindingResult(Errors errors) { // wrap errors in a Model Map model = new HashMap(); model.put(BindingResult.MODEL_KEY_PREFIX + COMMAND_NAME, errors); // replace the request context with one containing the errors MockPageContext pageContext = getPageContext(); RequestContext context = new RequestContext((HttpServletRequest) pageContext.getRequest(), model); pageContext.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, context); }