Package org.jasig.portal.api.portlet

Examples of org.jasig.portal.api.portlet.PortletDelegationDispatcher


        final String sessionKey = this.sessionKeyPrefix + this.fname;

        final PortletSession portletSession = renderRequest.getPortletSession();
        IPortletWindowId portletWindowId = (IPortletWindowId)portletSession.getAttribute(sessionKey);

        final PortletDelegationDispatcher portletDelegationDispatcher;
        final DelegateState delegateState;
        //No id in session, create a new dispatcher
        if (portletWindowId == null) {
            portletDelegationDispatcher = portletDelegationLocator.createRequestDispatcher(renderRequest, this.fname);
            portletWindowId = portletDelegationDispatcher.getPortletWindowId();
            portletSession.setAttribute(sessionKey, portletWindowId);

            final PortletMode portletMode = this.portletMode == null ? null : new PortletMode(this.portletMode);
            final WindowState windowState = this.windowState == null ? null : new WindowState(this.windowState);
           
            delegateState = new DelegateState(portletMode, windowState);
        }
        //id in session, get the old dispatcher
        else {
            portletDelegationDispatcher = portletDelegationLocator.getRequestDispatcher(renderRequest, portletWindowId);
            delegateState = null;
        }

        final DelegationRequest delegationRequest = new DelegationRequest();
        delegationRequest.setDelegateState(delegateState);
       
        //Setup base for portlet URLs
        delegationRequest.setParentPortletMode(this.parentUrlMode);
        delegationRequest.setParentWindowState(this.parentUrlState);
        delegationRequest.setParentParameters(this.parentUrlParameters);

        final JspWriter out = this.pageContext.getOut();
        try {
            portletDelegationDispatcher.doRender(renderRequest, renderResponse, delegationRequest, out);
        }
        catch (IOException e) {
            throw new JspException("Failed to execute delegate render on portlet '" + this.fname + "'", e);
        }
       
View Full Code Here


      final IPortletWindowId portletWindowId = (IPortletWindowId)portletSession.getAttribute(RenderPortletTag.DEFAULT_SESSION_KEY_PREFIX + fname);
      if (portletWindowId == null) {
          throw new IllegalStateException("Cannot execute configModeAciton without a delegate window ID in the session for key: " + RenderPortletTag.DEFAULT_SESSION_KEY_PREFIX + fname);
      }
     
      final PortletDelegationDispatcher requestDispatcher = this.portletDelegationLocator.getRequestDispatcher(actionRequest, portletWindowId);
     
      final DelegationActionResponse delegationResponse = requestDispatcher.doAction(actionRequest, actionResponse);
      final PortletUrl renderUrl = delegationResponse.getRenderUrl();
      final DelegateState delegateState = delegationResponse.getDelegateState();
        if (renderUrl == null ||
              (renderUrl.getPortletMode() != null && !IPortletAdaptor.CONFIG.equals(renderUrl.getPortletMode())) ||
              !IPortletAdaptor.CONFIG.equals(delegateState.getPortletMode())) {
View Full Code Here

      final IPortletWindowId portletWindowId = this.getDelegateWindowId(externalContext, fname);
      if (portletWindowId == null) {
          throw new IllegalStateException("Cannot execute configModeAciton without a delegate window ID in the session for key: " + RenderPortletTag.DEFAULT_SESSION_KEY_PREFIX + fname);
      }
     
      final PortletDelegationDispatcher requestDispatcher = this.portletDelegationLocator.getRequestDispatcher(actionRequest, portletWindowId);
     
      final DelegationActionResponse delegationResponse = requestDispatcher.doAction(actionRequest, actionResponse);
     
      final String redirectLocation = delegationResponse.getRedirectLocation();
      final DelegateState delegateState = delegationResponse.getDelegateState();
        if (redirectLocation != null ||
              (delegationResponse.getPortletMode() != null && !IPortletRenderer.CONFIG.equals(delegationResponse.getPortletMode())) ||
View Full Code Here

        final DelegationRequest delegationRequest = (DelegationRequest)model.get(DELEGATE_REQUEST);
       
        final PortletRequest portletRequest = (PortletRequest)request.getAttribute(Constants.PORTLET_REQUEST);
        final PortletResponse portletResponse = (PortletResponse)request.getAttribute(Constants.PORTLET_RESPONSE);
       
        final PortletDelegationDispatcher requestDispatcher = portletDelegationLocator.getRequestDispatcher(portletRequest, portletWindowId);
        if (requestDispatcher == null) {
            throw new IllegalArgumentException("No PortletDelegationDispatcher exists for portlet window id: " + portletWindowId);
        }
        this.logger.debug("Found delegation dispatcher for portlet window id {} - {}", portletWindowId, requestDispatcher);
       
        final DelegationResponse delegationResponse;
        final String phase = (String)request.getAttribute(PortletRequest.LIFECYCLE_PHASE);
        if (PortletRequest.RENDER_PHASE.equals(phase)){
            final PortletOutputHandler portletOutputHandler = (PortletOutputHandler)model.get(DELEGATE_RENDER_OUTPUT_HANDLER);
            if (portletOutputHandler != null) {
                this.logger.debug("Delegating RenderRequest with custom Writer and {}", delegationRequest);
                delegationResponse = requestDispatcher.doRender((RenderRequest)portletRequest, (RenderResponse)portletResponse, delegationRequest, portletOutputHandler);
            }
            else {
                this.logger.debug("Delegating RenderRequest with default Writer and {}", delegationRequest);
                delegationResponse = requestDispatcher.doRender((RenderRequest)portletRequest, (RenderResponse)portletResponse, delegationRequest);
            }
        }      
        else if (PortletRequest.RESOURCE_PHASE.equals(phase)){
            this.logger.debug("Delegating ResourceRequest and {}", delegationRequest);
            delegationResponse = requestDispatcher.doServeResource((ResourceRequest)portletRequest, (ResourceResponse)portletResponse, delegationRequest);
        }
        else {
            throw new UnsupportedOperationException("Portlet lifecycle phase " + phase + " is not supported by the delegation view");
        }
View Full Code Here

        final String sessionKey = this.sessionKeyPrefix + this.fname;

        final PortletSession portletSession = renderRequest.getPortletSession();
        IPortletWindowId portletWindowId = (IPortletWindowId)portletSession.getAttribute(sessionKey);

        final PortletDelegationDispatcher portletDelegationDispatcher;
        final DelegateState delegateState;
        //No id in session, create a new dispatcher
        if (portletWindowId == null) {
            portletDelegationDispatcher = portletDelegationLocator.createRequestDispatcher(renderRequest, this.fname);
            portletWindowId = portletDelegationDispatcher.getPortletWindowId();
            portletSession.setAttribute(sessionKey, portletWindowId);

            final PortletMode portletMode = PortletUtils.getPortletMode(this.portletMode);
            final WindowState windowState = PortletUtils.getWindowState(this.windowState);
           
            delegateState = new DelegateState(portletMode, windowState);
        }
        //id in session, get the old dispatcher
        else {
            portletDelegationDispatcher = portletDelegationLocator.getRequestDispatcher(renderRequest, portletWindowId);
            delegateState = null;
        }

        final DelegationRequest delegationRequest = new DelegationRequest();
        delegationRequest.setDelegateState(delegateState);
       
        //Setup base for portlet URLs
        delegationRequest.setParentPortletMode(this.parentUrlMode);
        delegationRequest.setParentWindowState(this.parentUrlState);
        delegationRequest.setParentParameters(this.parentUrlParameters);

        final JspWriter out = this.pageContext.getOut();
        try {
            portletDelegationDispatcher.doRender(renderRequest, renderResponse, delegationRequest, new JspWriterPortletOutputHandler(out, renderResponse));
        }
        catch (IOException e) {
            throw new JspException("Failed to execute delegate render on portlet '" + this.fname + "'", e);
        }
       
View Full Code Here

TOP

Related Classes of org.jasig.portal.api.portlet.PortletDelegationDispatcher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.