Package org.apache.pluto.driver.url.impl

Examples of org.apache.pluto.driver.url.impl.RelativePortalURLImpl


     *
     * @return the portal URL.
     */
    private PortalURL parse(String urlBase, String contextPath, String servletName, String pathInfo, String portletInfo) {
        // Construct portal URL using info retrieved from servlet request.
        PortalURL portalURL = new RelativePortalURLImpl(urlBase, contextPath, servletName+pathInfo, this);

        if (portletInfo == null) {
            if (servletName.contains(".jsp") && !servletName.endsWith(".jsp")) {
                int idx = servletName.indexOf(".jsp") + ".jsp".length();
                portletInfo = 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: " + portletInfo);
        }

        StringBuffer renderPath = new StringBuffer();
        StringTokenizer st = new StringTokenizer(portletInfo, "/", 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


        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

        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

TOP

Related Classes of org.apache.pluto.driver.url.impl.RelativePortalURLImpl

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.