Package org.apache.pluto.driver.url

Examples of org.apache.pluto.driver.url.PortalURL


       
        ServletContext containerServletContext = PortalRequestContext.getContext(request).getServletContext();
    DriverConfiguration driverConfig = (DriverConfiguration) containerServletContext
        .getAttribute(AttributeKeys.DRIVER_CONFIG);

    PortalURL portalURL = PortalURLParserImpl.getParser().parse(request);

      Map<String, PortletWindowThread> portletWindowThreads = new HashMap<String, PortletWindowThread>();

      ThreadGroup threadGroup = new ThreadGroup("FireEventThreads");
View Full Code Here


    public int doStartTag() throws JspException {
        PortalRequestContext portalEnv = PortalRequestContext.getContext(
                (HttpServletRequest) pageContext.getRequest());

        PortalURL portalURL = portalEnv.getRequestedPortalURL();

        // Check if someone else is maximized. If yes, don't show content.
        Map windowStates = portalURL.getWindowStates();
        for (Iterator it = windowStates.values().iterator(); it.hasNext();) {
            WindowState windowState = (WindowState) it.next();
            if (WindowState.MAXIMIZED.equals(windowState)) {
                pageContext.setAttribute(var, Boolean.TRUE);
                break;
View Full Code Here

        // Retrieve the portal environment.
        PortalRequestContext portalEnv = PortalRequestContext.getContext(
                (HttpServletRequest) pageContext.getRequest());       
       
        //find the current mode for use in 'selected' attrib of select option
    PortalURL requestedPortalUrl = portalEnv.getRequestedPortalURL();
        PortletWindowConfig windowConfig =
            PortletWindowConfig.fromId(evaluatedPortletId);
        // Retrieve the portlet container from servlet context.
        PortletContainer container = (PortletContainer)
                servletContext.getAttribute(AttributeKeys.PORTLET_CONTAINER);
       
        // Create the portlet window to render.
        PortletWindow window = null;
       
       
        try
        {
          // If this fails it means that the portlet will be not available.
          // Render Tag will take care of it.
          window = new PortletWindowImpl(container, windowConfig, requestedPortalUrl);
        }
        catch(RuntimeException ex)
        {
            if (LOG.isDebugEnabled()) {
                  LOG.debug("The portlet " + windowConfig.getPortletName() + " is not available. Is already deployed?");
              }
        }
   
        //start the markup
        StringBuffer tag = new StringBuffer();
    
        // Do not render if we don't have a window.
        if(window!=null)
        {
          PortletMode currentMode = requestedPortalUrl.getPortletMode(window.getId().getStringId());


          //        String strCurrentMode = currentMode.toString();       
          //        tag.append("Current mode: " + currentMode.toString());
          tag.append("<form action=\"\" name=\"modeSelectionForm\" style=\"display:inline\"><select onchange=\"self.location=this.options[this.selectedIndex].value\">");
          Set<PortletMode> modeSet = null;
          try {
            modeSet = driverConfig.getSupportedPortletModes(evaluatedPortletId);
          } catch (PortletContainerException e) {
            throw new JspException(e);
          }

          if (modeSet != null) {
            Iterator<PortletMode> i = modeSet.iterator();
            while (i.hasNext()) {
              PortletMode mode = i.next();

              PortalURL portalUrl =  portalEnv.createPortalURL();
              portalUrl.setPortletMode(evaluatedPortletId, mode);

              // Build a string buffer containing the anchor tag
              tag.append("<option value=\"" + portalUrl.toString() + "\"");
              //Add 'selected' attribute for current mode.
              if (mode.equals(currentMode)) {
                tag.append(" selected=\"true\"");
              }
              tag.append(">");
View Full Code Here

        if (isWindowStateAllowed(driverConfig, state)) {
            // Retrieve the portal environment.
            PortalRequestContext portalEnv = PortalRequestContext.getContext(
                    (HttpServletRequest) pageContext.getRequest());

            PortalURL portalUrl =  portalEnv.createPortalURL();
            portalUrl.setWindowState(evaluatedPortletId, new WindowState(state));

            // Build a string buffer containing the anchor tag
            StringBuffer tag = new StringBuffer();
//            tag.append("<a class=\"" + ToolTips.CSS_CLASS_NAME + "\" href=\"" + portalUrl.toString() + "\">");
//            tag.append("<span class=\"" + state + "\"></span>");
//            tag.append("<span class=\"" + ToolTips.CSS_CLASS_NAME + "\">");
//            tag.append(ToolTips.forWindowState(new WindowState(state)));
//            tag.append("</span></a>");
            tag.append("<a title=\"");
            tag.append(ToolTips.forWindowState(new WindowState(state)));
            tag.append("\" ");
            tag.append("href=\"" + portalUrl.toString() + "\">");
            tag.append("<img border=\"0\" src=\"" + icon + "\" />");
            tag.append("</a>");

            // Print the mode anchor tag.
            try {
View Full Code Here

        if (isPortletModeAllowed(driverConfig, portletMode)) {
            // Retrieve the portal environment.
            PortalRequestContext portalEnv = PortalRequestContext.getContext(
                    (HttpServletRequest) pageContext.getRequest());       

            PortalURL portalUrl =  portalEnv.createPortalURL();
            portalUrl.setPortletMode(evaluatedPortletId, new PortletMode(portletMode));

            // Build a string buffer containing the anchor tag
            StringBuffer tag = new StringBuffer();
//            tag.append("<a class=\"" + ToolTips.CSS_CLASS_NAME + "\" href=\"" + portalUrl.toString() + "\">");
//            tag.append("<span class=\"" + portletMode + "\"></span>");
//            tag.append("<span class=\"" + ToolTips.CSS_CLASS_NAME + "\">");
//            tag.append(ToolTips.forMode(new PortletMode(portletMode)));
//            tag.append("</span></a>");
            tag.append("<a title=\"");
            tag.append(ToolTips.forMode(new PortletMode(portletMode)));
            tag.append("\" ");
            tag.append("href=\"" + portalUrl.toString() + "\">");
            tag.append("<span class=\"" + portletMode + "\"></span>");      
            tag.append("</a>");
            // Print the mode anchor tag.
            try {
                JspWriter out = pageContext.getOut();
View Full Code Here

        }
       
        // Retrieve the current portal URL.
        PortalRequestContext portalEnv = PortalRequestContext.getContext(
                (HttpServletRequest) pageContext.getRequest());
        PortalURL portalURL = portalEnv.getRequestedPortalURL();
       
        // Retrieve the portlet container from servlet context.
        PortletContainer container = (PortletContainer)
                servletContext.getAttribute(AttributeKeys.PORTLET_CONTAINER);
       
        // Create the portlet window to render.
        PortletWindow window = null;


        try {
          window = new PortletWindowImpl(container, windowConfig, portalURL);
        } catch(RuntimeException e) // FIXME: Prose a change to anything else, handle it.
        {
          if (LOG.isDebugEnabled()) {
              LOG.debug("The portlet " + windowConfig.getPortletName() + " is not available. Is already deployed?");
          }
        }

      // Create portal servlet response to wrap the original
      // HTTP servlet response.
      PortalServletResponse portalResponse = new PortalServletResponse(
                (HttpServletResponse) pageContext.getResponse());
     
     
        if(window!=null)
        {
          // Check if someone else is maximized. If yes, don't show content.
          Map windowStates = portalURL.getWindowStates();
          for (Iterator it = windowStates.keySet().iterator(); it.hasNext(); ) {
            String windowId = (String) it.next();
            WindowState windowState = (WindowState) windowStates.get(windowId);
            if (WindowState.MAXIMIZED.equals(windowState)
                && !window.getId().getStringId().equals(windowId)) {
View Full Code Here

    {
        if (!isClosed())
        {
            super.close();
            new PortletURLImpl(this, portletURLProvider).filterURL();
            PortalURL url = portletURLProvider.apply();
            PortalRequestContext.getContext(getServletRequest()).mergePortalURL(url, getPortletWindow().getId().getStringId());
        }
    }
View Full Code Here

      boolean actionRequestProcessed = false;
     
        PortalRequestContext portalRequestContext =
            new PortalRequestContext(getServletContext(), request, response);

        PortalURL portalURL = portalRequestContext.getRequestedPortalURL();
        String actionWindowId = portalURL.getActionWindow();

        PortletWindowConfig actionWindowConfig =
            actionWindowId == null
                ? null
                : PortletWindowConfig.fromId(actionWindowId);

        // Action window config will only exist if there is an action request.
        if (actionWindowConfig != null) {
            PortletWindowImpl portletWindow = new PortletWindowImpl(container,
                actionWindowConfig, portalURL);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Processing action request for window: "
                    + portletWindow.getId().getStringId());
            }
            try {
                container.doAction(portletWindow, request, response);
            } catch (PortletContainerException ex) {
                throw new ServletException(ex);
            } catch (PortletException ex) {
                throw new ServletException(ex);
            }
            if (LOG.isDebugEnabled()) {
                LOG.debug("Action request processed.\n\n");
            }
           
            actionRequestProcessed = true;
        }
       
        if (LOG.isDebugEnabled()) {
            LOG.debug("Render Path: " + portalURL.getRenderPath());
            LOG.debug("Servlet Path: " + portalURL.getServletPath());         
        }

        return actionRequestProcessed;
    }
View Full Code Here

        }

        PortalRequestContext portalRequestContext =
            new PortalRequestContext(getServletContext(), request, response);

        PortalURL portalURL = null;
       
        try {
          portalURL = portalRequestContext.getRequestedPortalURL();
        } catch(Exception ex) {
          String msg = "Cannot handle request for portal URL. Problem: "  + ex.getMessage();
          LOG.error(msg, ex);
          throw new ServletException(msg, ex);
        }
        String actionWindowId = portalURL.getActionWindow();
        String resourceWindowId = portalURL.getResourceWindow();
       
        PortletWindowConfig actionWindowConfig = null;
        PortletWindowConfig resourceWindowConfig = null;
       
    if (resourceWindowId != null){
      resourceWindowConfig = PortletWindowConfig.fromId(resourceWindowId);
    } else if(actionWindowId != null){
       actionWindowConfig = PortletWindowConfig.fromId(actionWindowId);
    }

        // Action window config will only exist if there is an action request.
        if (actionWindowConfig != null) {
            PortletWindowImpl portletWindow = new PortletWindowImpl(container,
                actionWindowConfig, portalURL);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Processing action request for window: "
                    + portletWindow.getId().getStringId());
            }
            try {
                container.doAction(portletWindow, request, response);
            } catch (PortletContainerException ex) {
              LOG.error(ex.getMessage(), ex);
                throw new ServletException(ex);
            } catch (PortletException ex) {
              LOG.error(ex.getMessage(), ex);
                throw new ServletException(ex);
            }
            if (LOG.isDebugEnabled()) {
              LOG.debug("Action request processed.\n\n");
            }
        }
        //Resource request
        else if (resourceWindowConfig != null) {
            PortletWindowImpl portletWindow = new PortletWindowImpl(container,
                               resourceWindowConfig, portalURL);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Processing resource Serving request for window: "
                               + portletWindow.getId().getStringId());
            }
            try {
                container.doServeResource(portletWindow, request, response);
            } catch (PortletContainerException ex) {
              LOG.error(ex.getMessage(), ex);
                throw new ServletException(ex);
            } catch (PortletException ex) {
              LOG.error(ex.getMessage(), ex);
                throw new ServletException(ex);
            }
            if (LOG.isDebugEnabled()) {
               LOG.debug("Resource serving request processed.\n\n");
            }
        }
        // Otherwise (actionWindowConfig == null), handle the render request.
        else {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Processing render request.");
          }
            PageConfig pageConfig = portalURL.getPageConfig(servletContext);
            if (pageConfig == null)
            {
              String renderPath = (portalURL == null ? "" : portalURL.getRenderPath());
                String msg = "PageConfig for render path [" + renderPath + "] could not be found.";
                LOG.error(msg);
                throw new ServletException(msg);
            }
           
View Full Code Here

        if (!isReleased())
        {
            close();
            if (!redirect || renderURLParamName != null)
            {
                PortalURL url = PortalRequestContext.getContext(getServletRequest()).createPortalURL();
                if (redirect)
                {
                    try
                    {
                        return redirectLocation + "?" + URLEncoder.encode(renderURLParamName, "UTF-8") + "=" + URLEncoder.encode(url.toURL(true), "UTF-8");
                    }
                    catch (UnsupportedEncodingException e)
                    {
                        // Cannot happen: UTF-8 is a buildin/required encoder
                        return null;
                    }
                }
                else
                {
                    return url.toURL(false);
                }
            }
            else
            {
                return redirectLocation;
View Full Code Here

TOP

Related Classes of org.apache.pluto.driver.url.PortalURL

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.