org.springframework.web.servlet.tags.RequestContextAwareTag Java Examples
The following examples show how to use
org.springframework.web.servlet.tags.RequestContextAwareTag.
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); }
Example #13
Source File: PageNavigationTagTest.java From sinavi-jfw with Apache License 2.0 | 5 votes |
@Before public void setUp() { MockServletContext sc = new MockServletContext(); WebApplicationContext wac = new StaticWebApplicationContext(); sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac); req = new MockHttpServletRequest(sc); resp = new MockHttpServletResponse(); context = new MockPageContext(sc, req, resp); rcon = new RequestContext(req, sc); context.setAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE, rcon); }
Example #14
Source File: AbstractHtmlElementTagTests.java From spring-analysis-note with MIT License | 4 votes |
protected final RequestContext getRequestContext() { return (RequestContext) getPageContext().getAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE); }
Example #15
Source File: AbstractHtmlElementTagTests.java From java-technology-stack with MIT License | 4 votes |
protected final RequestContext getRequestContext() { return (RequestContext) getPageContext().getAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE); }
Example #16
Source File: AbstractHtmlElementTagTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
protected final RequestContext getRequestContext() { return (RequestContext) getPageContext().getAttribute(RequestContextAwareTag.REQUEST_CONTEXT_PAGE_ATTRIBUTE); }