/** * 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 | RuntimeException ex) { logger.error(ex.getMessage(), ex); throw ex; } catch (Exception ex) { logger.error(ex.getMessage(), ex); throw new JspTagException(ex.getMessage()); } }
/** * 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 | RuntimeException ex) { logger.error(ex.getMessage(), ex); throw ex; } catch (Exception ex) { logger.error(ex.getMessage(), ex); throw new JspTagException(ex.getMessage()); } }
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; }
/** * 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()); } }