use of org.springframework.web.servlet.support.JspAwareRequestContext in project spring-framework by spring-projects.
the class AbstractHtmlElementTagTests method createAndPopulatePageContext.
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;
}
use of org.springframework.web.servlet.support.JspAwareRequestContext in project spring-framework by spring-projects.
the class RequestContextAwareTag method doStartTag.
/**
* Create and expose the current RequestContext.
* Delegates to {@link #doStartTagInternal()} for actual work.
* @see #REQUEST_CONTEXT_PAGE_ATTRIBUTE
* @see org.springframework.web.servlet.support.JspAwareRequestContext
*/
@Override
public final int doStartTag() throws JspException {
try {
this.requestContext = (RequestContext) this.pageContext.getAttribute(REQUEST_CONTEXT_PAGE_ATTRIBUTE);
if (this.requestContext == null) {
this.requestContext = new JspAwareRequestContext(this.pageContext);
this.pageContext.setAttribute(REQUEST_CONTEXT_PAGE_ATTRIBUTE, this.requestContext);
}
return doStartTagInternal();
} catch (JspException ex) {
logger.error(ex.getMessage(), ex);
throw ex;
} catch (RuntimeException ex) {
logger.error(ex.getMessage(), ex);
throw ex;
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
throw new JspTagException(ex.getMessage());
}
}
Aggregations