Search in sources :

Example 1 with RenderPortletOutputHandler

use of org.apereo.portal.portlet.rendering.RenderPortletOutputHandler 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 RenderPortletOutputHandler

use of org.apereo.portal.portlet.rendering.RenderPortletOutputHandler in project uPortal by Jasig.

the class PortletRenderHeaderExecutionWorker method callInternal.

/**
 * Obtain the RENDER_HEADER output. Note that uPortal supports the model of obtaining HTML
 * markup from the portlet, whether from a Spring view or servlet output and inserting it within
 * the HTML HEAD section of the page. uPortal does not support the model where the portlet
 * creates DOM elements to be written to the HEAD section and constructs the HTML output; e.g.
 * the following does NOT work in uPortal:
 *
 * <p>
 *
 * <pre>
 * Element linkElement = response.createElement(HTML.Tag.SCRIPT.toString());
 * linkElement.setAttribute(HTML.Attribute.TYPE.toString(), "text/javascript");
 * linkElement.setAttribute(HTML.Attribute.SRC.toString(), cssUrl);
 * linkElement.setTextContent(" ");
 * response.addProperty(MimeResponse.MARKUP_HEAD_ELEMENT, linkElement);
 * </pre>
 *
 * @see PortletExecutionWorker#callInternal()
 */
@Override
protected PortletRenderResult callInternal() throws Exception {
    final String characterEncoding = response.getCharacterEncoding();
    final RenderPortletOutputHandler renderPortletOutputHandler = new RenderPortletOutputHandler(characterEncoding);
    final PortletRenderResult result = portletRenderer.doRenderHeader(portletWindowId, request, response, renderPortletOutputHandler);
    this.output = renderPortletOutputHandler.getOutput();
    return result;
}
Also used : RenderPortletOutputHandler(org.apereo.portal.portlet.rendering.RenderPortletOutputHandler) PortletRenderResult(org.apereo.portal.portlet.rendering.PortletRenderResult)

Example 3 with RenderPortletOutputHandler

use of org.apereo.portal.portlet.rendering.RenderPortletOutputHandler in project uPortal by Jasig.

the class PortletRenderExecutionWorker method callInternal.

@Override
protected PortletRenderResult callInternal() throws Exception {
    final String characterEncoding = response.getCharacterEncoding();
    final RenderPortletOutputHandler renderPortletOutputHandler = new RenderPortletOutputHandler(characterEncoding);
    final PortletRenderResult result = portletRenderer.doRenderMarkup(portletWindowId, request, response, renderPortletOutputHandler);
    this.output = renderPortletOutputHandler.getOutput();
    return result;
}
Also used : RenderPortletOutputHandler(org.apereo.portal.portlet.rendering.RenderPortletOutputHandler) PortletRenderResult(org.apereo.portal.portlet.rendering.PortletRenderResult)

Aggregations

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