Search in sources :

Example 1 with PortletHttpServletRequestWrapper

use of org.apereo.portal.utils.web.PortletHttpServletRequestWrapper in project uPortal by Jasig.

the class PortletFailureExecutionWorker method renderError.

protected synchronized void renderError(long timeout) {
    // Make sure the error rendering only happens once
    if (this.completed > 0) {
        return;
    }
    // Wrap the request to scope the attributes to just this execution
    final PortletHttpServletRequestWrapper wrappedRequest = new PortletHttpServletRequestWrapper(request);
    wrappedRequest.setAttribute(PortletErrorController.REQUEST_ATTRIBUTE__CURRENT_FAILED_PORTLET_WINDOW_ID, failedPortletWindowId);
    wrappedRequest.setAttribute(PortletErrorController.REQUEST_ATTRIBUTE__CURRENT_EXCEPTION_CAUSE, cause);
    // Run pre-execution interceptors
    for (final IPortletExecutionInterceptor interceptor : this.interceptors) {
        interceptor.preExecution(request, response, this);
    }
    // error happens.
    try {
        final String characterEncoding = response.getCharacterEncoding();
        final RenderPortletOutputHandler renderPortletOutputHandler = new RenderPortletOutputHandler(characterEncoding);
        this.portletRenderResult = this.portletRenderer.doRenderMarkup(errorPortletWindowId, wrappedRequest, response, renderPortletOutputHandler);
        doPostExecution(null);
        this.output = renderPortletOutputHandler.getOutput();
    } catch (Exception e) {
        doPostExecution(e);
        this.logger.error("Exception while dispatching to error handling portlet", e);
        this.output = "Error Portlet Unavailable. Please contact your portal adminstrators.";
    }
    this.completed = System.currentTimeMillis();
}
Also used : RenderPortletOutputHandler(org.apereo.portal.portlet.rendering.RenderPortletOutputHandler) PortletHttpServletRequestWrapper(org.apereo.portal.utils.web.PortletHttpServletRequestWrapper)

Example 2 with PortletHttpServletRequestWrapper

use of org.apereo.portal.utils.web.PortletHttpServletRequestWrapper in project uPortal by Jasig.

the class PortletRendererImpl method setupPortletRequest.

protected HttpServletRequest setupPortletRequest(HttpServletRequest httpServletRequest) {
    final PortletHttpServletRequestWrapper portletHttpServletRequestWrapper = new PortletHttpServletRequestWrapper(httpServletRequest);
    portletHttpServletRequestWrapper.setAttribute(PortletDelegationLocator.PORTLET_DELECATION_LOCATOR_ATTR, this.portletDelegationLocator);
    return portletHttpServletRequestWrapper;
}
Also used : PortletHttpServletRequestWrapper(org.apereo.portal.utils.web.PortletHttpServletRequestWrapper)

Aggregations

PortletHttpServletRequestWrapper (org.apereo.portal.utils.web.PortletHttpServletRequestWrapper)2 RenderPortletOutputHandler (org.apereo.portal.portlet.rendering.RenderPortletOutputHandler)1