Package org.apache.pluto.driver.url

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


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

        String urlBase = request.getScheme()+"://" + request.getServerName() + ":" + request.getServerPort();
        // Construct portal URL using info retrieved from servlet request.
        PortalURL portalURL =  new RelativePortalURLImpl(urlBase, contextPath, servletName, this);

        // Support added for filter.  Should we seperate into a different impl?
        String pathInfo = request.getPathInfo();
        if (pathInfo == null) {
            if(servletName.contains(".jsp") && !servletName.endsWith(".jsp")) {
                int idx = servletName.indexOf(".jsp")+".jsp".length();
                pathInfo = servletName.substring(idx);
                servletName = servletName.substring(0, idx);
                portalURL = new RelativePortalURLImpl(urlBase, 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);
          }
//           Resource window definition: portalURL.setResourceWindow().
           else if (token.startsWith(PREFIX + RESOURCE)) {
               portalURL.setResourceWindow(decodeControlParameter(token)[0]);
           }
          // Action window definition: portalURL.setActionWindow().
          else if (token.startsWith(PREFIX + ACTION)) {
            portalURL.setActionWindow(decodeControlParameter(token)[0]);
          }
            // Cacheability definition: portalURL.setCacheability().
            else if (token.startsWith(PREFIX + CACHE_LEVEL)) {
                portalURL.setCacheability(decodeControlParameter(token)[0]);
            }
            // ResourceID definition: portalURL.setResourceID().
            else if (token.startsWith(PREFIX + RESOURCE_ID)) {
                portalURL.setResourceID(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 if(token.startsWith(PREFIX + RENDER_PARAM)) {
            String value = null;
            if (st.hasMoreTokens()) {
              value = st.nextToken();
            }
            //set the
            PortalURLParameter param = decodeParameter(token, value);
            portalURL.addParameter(param);


          }
            else if (token.startsWith(PREFIX + PRIVATE_RENDER_PARAM)){
                String value = null;
                if (st.hasMoreTokens()) {
                    value = st.nextToken();
                }
                PortalURLParameter param = decodePublicParameter(token, value);
                if( param != null )
                {
                    //set private (Resource) parameter in portalURL
                    portalURL.getPrivateRenderParameters().put(param.getName(), param.getValues());
                }
            }
          else if (token.startsWith(PREFIX + PUBLIC_RENDER_PARAM)){
            String value = null;
            if (st.hasMoreTokens()) {
              value = st.nextToken();
            }
            PortalURLParameter param = decodePublicParameter(token, value);
            if( param != null )
            {
              //set public parameter in portalURL
              portalURL.addPublicParameterCurrent(param.getName(), param.getValues());
            }
          }
        }
        if (renderPath.length() > 0) {
            portalURL.setRenderPath(renderPath.toString());
        }

        // Return the portal URL.
        return portalURL;
    }
View Full Code Here


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

        PortalURL portalURL = portalRequestContext.getRequestedPortalURL();
        String actionWindowId = portalURL.getActionWindow();
        PortletWindowConfig actionWindowConfig = getDriverConfiguration()
            .getPortletWindowConfig(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

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

                pageContext.getRequest();

        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(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, windowConfig, 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

        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

    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
     
        PortalEnvironment portalEnvironment = new PortalEnvironment(
            request, response);
        PortalURL portalURL = portalEnvironment.getRequestedPortalURL();
        String actionWindowId = portalURL.getActionWindow();
        PortletWindowConfig actionWindowConfig = getDriverConfiguration()
            .getPortletWindowConfig(actionWindowId);

        // Action window config will only exist if there is an action request.
        if (actionWindowConfig != null) {
View Full Code Here

        }
       
        // Create portal URL.
        HttpServletRequest request = (HttpServletRequest)
            pageContext.getRequest();
        PortalURL portalUrl = PortalURLFactory.getFactory()
            .createPortalURL(request);
       
        // 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(portalUrl.toString());
        } catch (IOException ex) {
            throw new JspException(ex);
        }
       
        // Skip the tag body.
View Full Code Here

        }
       
        // Retrieve the current portal URL.
        PortalEnvironment portalEnv = PortalEnvironment.getPortalEnvironment(
            (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

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.