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


        }
       
        // 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 = new PortletWindowImpl(container, windowConfig, portalURL);
       
        // 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

        // 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 = new PortletWindowImpl(container, windowConfig, requestedPortalUrl);
   
    PortletMode currentMode = requestedPortalUrl.getPortletMode(window.getId().getStringId());

        //start the markup
        StringBuffer tag = new StringBuffer();
//        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

    throws ServletException, IOException {

        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(
                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");
            }
        }
       
        // Otherwise (actionWindowConfig == null), handle the render request.
        else {
          if (LOG.isDebugEnabled()) {
            LOG.debug("Processing render request.");
          }
            PageConfig pageConfig = getPageConfig(portalURL);
            if (pageConfig == null)
            {
                LOG.error("PageConfig for render path [" + portalURL.getRenderPath() + "] could not be found.");
            }
           
            request.setAttribute(AttributeKeys.CURRENT_PAGE, pageConfig);
            String uri = (pageConfig.getUri() != null)
                ? pageConfig.getUri() : DEFAULT_PAGE_URI;
View Full Code Here

                pageContext.getResponse();

        PortalRequestContext ctx = (PortalRequestContext)
            request.getAttribute(PortalRequestContext.REQUEST_KEY);

        PortalURL portalUrl =  ctx.createPortalURL();

        // Encode window state of the current portlet in the portal URL.
        String portletId = parentTag.getEvaluatedPortletId();
        if (windowState != null) {
            portalUrl.setWindowState(portletId, new WindowState(windowState));
        }

        // Encode portlet mode of the current portlet in the portal URL.
        if (portletMode != null) {
            portalUrl.setPortletMode(portletId, new PortletMode(portletMode));
        }

        // Print the portal URL as a string to the page.
        try {
            pageContext.getOut().print(response.encodeURL(portalUrl.toString()));
        } catch (IOException ex) {
            throw new JspException(ex);
        }

        // Skip the tag body.
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

        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));

            // Print the mode anchor tag.
            try {
                JspWriter out = pageContext.getOut();
                out.print("<a href=\"");
                out.print(portalUrl.toString());
                out.print("\">");
                out.print("<span class=\"");
                out.print(portletMode);
                out.print("\"></span></a>");
            } catch (IOException ex) {
View Full Code Here

        }
       
        // Retrieve the current portal URL.
        PortalRequestContext portalEnv = PortalRequestContext.getContext(
                (HttpServletRequest) pageContext.getRequest());
        PortalURL portalURL = portalEnv.getRequestedPortalURL();
       
        // Create the portlet window to render.
        PortletWindow window = new PortletWindowImpl(windowConfig, portalURL);
       
        // 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

        int port = request.getServerPort();
        String contextPath = request.getContextPath();
        String servletName = request.getServletPath();
       
        // Construct portal URL using info retrieved from servlet request.
        PortalURL portalURL = null;
        if ((request.isSecure() && port != 443)
            || (!request.isSecure() && port != 80)) {
          portalURL = new PortalURLImpl(protocol, server, port, contextPath, servletName);
        } else {
          portalURL = new PortalURLImpl(protocol, server, contextPath, servletName);
        }
       
        String pathInfo = request.getPathInfo();
        if (pathInfo == null) {
            return portalURL;
        }
       
        if (LOG.isDebugEnabled()) {
            LOG.debug("Parsing request pathInfo: " + pathInfo);
        }
        StringBuffer renderPath = new StringBuffer();
        StringTokenizer st = new StringTokenizer(pathInfo, "/", false);
        while (st.hasMoreTokens()) {
         
          String token = st.nextToken();
         
          // Part of the render path: append to renderPath.
          if (!token.startsWith(PREFIX)) {
//            renderPath.append(token);
            //Fix for PLUTO-243
            renderPath.append('/').append(token);
          }
          // Action window definition: portalURL.setActionWindow().
          else if (token.startsWith(PREFIX + ACTION)) {
            portalURL.setActionWindow(decodeControlParameter(token)[0]);
          }
          // Window state definition: portalURL.setWindowState().
          else if (token.startsWith(PREFIX + WINDOW_STATE)) {
            String[] decoded = decodeControlParameter(token);
            portalURL.setWindowState(decoded[0], new WindowState(decoded[1]));
          }
          // Portlet mode definition: portalURL.setPortletMode().
          else if (token.startsWith(PREFIX + PORTLET_MODE)) {
            String[] decoded = decodeControlParameter(token);
            portalURL.setPortletMode(decoded[0], new PortletMode(decoded[1]));
          }
          // Portal URL parameter: portalURL.addParameter().
          else {
            String value = null;
            if (st.hasMoreTokens()) {
              value = st.nextToken();
            }
            portalURL.addParameter(decodeParameter(token, value));
          }
        }
        if (renderPath.length() > 0) {
            portalURL.setRenderPath(renderPath.toString());
        }
       
        // Return the portal URL.
        return portalURL;
    }
View Full Code Here

            logger.debug("Rendering Portlet Window: " + windowConfig);
        }

        // Retrieve the current portal URL.
        PortalRequestContext portalEnv = PortalRequestContext.getContext(jahiaContextRequest);
        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 = new PortletWindowImpl(container, windowConfig, portalURL);

        // 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

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.