Package org.apache.pluto.driver.url

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


        HttpServletResponse response = (HttpServletResponse)
                pageContext.getResponse();

        PortalRequestContext ctx = PortalRequestContext.getContext(request);

        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


        this.window = portletWindow.getId().getStringId();
    }
   
    public PortalURL apply()
    {
        PortalURL url = this.url.clone();
        if (PortletURLProvider.TYPE.ACTION == type)
        {
            url.setActionWindow(window);
            url.setResourceWindow(null);
            url.clearParameters(window);
        }
        else if (PortletURLProvider.TYPE.RESOURCE == type)
        {
            url.setActionWindow(null);
            url.setResourceWindow(window);
            if (!ResourceURL.FULL.equals(cacheLevel))
            {
                for (PortalURLParameter parm : url.getParameters())
                {
                    if (window.equals(parm.getWindowId()))
                    {
                        url.getPrivateRenderParameters().put(parm.getName(), parm.getValues());
                    }                           
                }
            }
            url.clearParameters(window);
        }
        else
        {
            url.setResourceWindow(null);
            url.setActionWindow(null);
            url.clearParameters(window);
        }
        if (portletMode != null)
        {
            url.setPortletMode(window, portletMode);
        }
        if (windowState != null)
        {
            url.setWindowState(window, windowState);
        }
        if (renderParameters != null)
        {
            for (Map.Entry<String,String[]> entry : renderParameters.entrySet())
            {
                if (publicRenderParameters == null || !publicRenderParameters.containsKey(entry.getKey()))
                {
                    url.addParameter(new PortalURLParameter(window, entry.getKey(), entry.getValue()));
                }
            }
        }
        if (publicRenderParameters != null)
        {
            for (Map.Entry<String,String[]> entry : publicRenderParameters.entrySet())
            {
                url.getNewPublicParameters().put(entry.getKey(),entry.getValue() != null ? entry.getValue() : new String[]{null});
            }
        }
        url.setResourceID(resourceID);
        url.setCacheability(cacheLevel);
        return url;
    }
View Full Code Here

    {
        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

        String contextPath = request.getContextPath();
        String servletName = request.getServletPath();

        // Construct portal URL using info retrieved from servlet request.
        PortalURL portalURL =  new RelativePortalURLImpl(contextPath, servletName, this);

        // Support added for filter.  Should we seperate into a different impl?
        String pathInfo = request.getPathInfo();
        if (pathInfo == null) {
            if((servletName.indexOf(".jsp") != -1) && !servletName.endsWith(".jsp")) {
                int idx = servletName.indexOf(".jsp")+".jsp".length();
                pathInfo = servletName.substring(idx);
                servletName = servletName.substring(0, idx);
                portalURL = new RelativePortalURLImpl(contextPath, servletName, this);
            } else {
                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();
            }

            // Defect PLUTO-361
            // ADDED
            PortalURLParameter param = decodeParameter( token, value );
            if( param != null )
            {
              portalURL.addParameter( param );
            }
            // REMOVED
            // portalURL.addParameter(decodeParameter(token, value));
          }
        }
        if (renderPath.length() > 0) {
            portalURL.setRenderPath(renderPath.toString());
        }

        // Return the portal URL.
        return portalURL;
    }
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>");
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>");
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

        String contextPath = request.getContextPath();
        String servletName = request.getServletPath();

        // Construct portal URL using info retrieved from servlet request.
        PortalURL portalURL =  new RelativePortalURLImpl(contextPath, servletName);

        // Support added for filter.  Should we seperate into a different impl?
        String pathInfo = request.getPathInfo();
        if (pathInfo == null) {
            if(servletName.indexOf(".jsp") > 0 && !servletName.endsWith(".jsp")) {
                int idx = servletName.indexOf(".jsp")+".jsp".length();
                pathInfo = servletName.substring(idx);
                servletName = servletName.substring(0, idx);
                portalURL = new RelativePortalURLImpl(contextPath, servletName);
            } else {
                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

        String contextPath = request.getContextPath();
        String servletName = request.getServletPath();

        // Construct portal URL using info retrieved from servlet request.
        PortalURL portalURL =  new RelativePortalURLImpl(contextPath, servletName, this);

        // Support added for filter.  Should we seperate into a different impl?
        String pathInfo = request.getPathInfo();
        if (pathInfo == null) {
            if((servletName.indexOf(".jsp") != -1) && !servletName.endsWith(".jsp")) {
                int idx = servletName.indexOf(".jsp")+".jsp".length();
                pathInfo = servletName.substring(idx);
                servletName = servletName.substring(0, idx);
                portalURL = new RelativePortalURLImpl(contextPath, servletName, this);
            } else {
                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();
                }

                // Defect PLUTO-361
                // ADDED
                PortalURLParameter param = decodeParameter( token, value );
                if( param != null )
                {
                    portalURL.addParameter( param );
                }
                // REMOVED
                // portalURL.addParameter(decodeParameter(token, value));
            }
        }
        if (renderPath.length() > 0) {
            portalURL.setRenderPath(renderPath.toString());
        }

        // Return the portal URL.
        return portalURL;
    }
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)
            {
                // TODO Shouldn't we throw an exception here?
                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

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.