Examples of URLGenerator


Examples of org.apache.wsrp4j.consumer.URLGenerator

            final WSRPPortlet portlet = this.environment.getPortletRegistry().getPortlet(portletKey);
            try {
                SimplePortletWindowSession windowSession = this.adapter.getSimplePortletWindowSession(portlet, portletInstanceKey, user);
                if ( this.environment != null && windowSession != null ) {
                    this.adapter.setCurrentCopletInstanceData(copletInstanceData);
                    URLGenerator urlGenerator = this.environment.getURLGenerator();

                    String[] supportedWindowStates = (String[])copletInstanceData.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_PORTLET_WINDOWSTATES);
                    String ws = windowSession.getWindowState();
                    if ( ws == null ) {
                        ws = WindowStates._normal;
                    }

                    if ( !ws.equals(WindowStates._minimized)
                         && ArrayUtils.contains(supportedWindowStates, WindowStates._minimized)) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.WINDOW_STATE, WindowStates._minimized);
                       
                        final String link = urlGenerator.getRenderURL(p);
                        XMLUtils.createElement(contenthandler, "minimize-uri", link);
                    }
                    if ( !ws.equals(WindowStates._normal)
                          && ArrayUtils.contains(supportedWindowStates, WindowStates._normal)) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.WINDOW_STATE, WindowStates._normal);

                        final String link = urlGenerator.getRenderURL(p);
                        XMLUtils.createElement(contenthandler, "maximize-uri", link);
                    }
                    if ( !ws.equals(WindowStates._maximized)
                          && ArrayUtils.contains(supportedWindowStates, WindowStates._maximized)) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.WINDOW_STATE, WindowStates._maximized);

                        final String link = urlGenerator.getRenderURL(p);                       
                        XMLUtils.createElement(contenthandler, "fullscreen-uri", link);
                    }

                    String[] supportedModes = (String[])copletInstanceData.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_PORTLET_MODES);
                    String pm = windowSession.getMode();
                    if ( pm == null ) {
                        pm = Modes._view;
                    }
                    if ( !pm.equals(Modes._edit)
                         && ArrayUtils.contains(supportedModes, Modes._edit) ) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.PORTLET_MODE, Modes._edit);

                        final String link = urlGenerator.getRenderURL(p);                       
                        XMLUtils.createElement(contenthandler, "edit-uri", link);                   
                    }
                    if ( !pm.equals(Modes._help)
                        && ArrayUtils.contains(supportedModes, Modes._help) ) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.PORTLET_MODE, Modes._help);

                        final String link = urlGenerator.getRenderURL(p);                       
                        XMLUtils.createElement(contenthandler, "help-uri", link);                   
                    }               
                    if ( !pm.equals(Modes._view)
                        && ArrayUtils.contains(supportedModes, Modes._view) ) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.PORTLET_MODE, Modes._view);

                        final String link = urlGenerator.getRenderURL(p);                       
                        XMLUtils.createElement(contenthandler, "view-uri", link);                   
                    }
                }
            } catch (WSRPException ignore) {
                // we ignore this
View Full Code Here

Examples of org.apache.wsrp4j.consumer.URLGenerator

            final WSRPPortlet portlet = this.environment.getPortletRegistry().getPortlet(portletKey);
            try {
                SimplePortletWindowSession windowSession = this.adapter.getSimplePortletWindowSession(portlet, portletInstanceKey, user);
                if ( this.environment != null && windowSession != null ) {
                    this.adapter.setCurrentCopletInstanceData(copletInstanceData);
                    URLGenerator urlGenerator = this.environment.getURLGenerator();

                    String[] supportedWindowStates = (String[])copletInstanceData.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_PORTLET_WINDOWSTATES);
                    String ws = windowSession.getWindowState();
                    if ( ws == null ) {
                        ws = WindowStates._normal;
                    }

                    if ( !ws.equals(WindowStates._minimized)
                         && ArrayUtils.contains(supportedWindowStates, WindowStates._minimized)) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.WINDOW_STATE, WindowStates._minimized);
                       
                        final String link = urlGenerator.getRenderURL(p);
                        XMLUtils.createElement(contenthandler, "minimize-uri", link);
                    }
                    if ( !ws.equals(WindowStates._normal)
                          && ArrayUtils.contains(supportedWindowStates, WindowStates._normal)) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.WINDOW_STATE, WindowStates._normal);

                        final String link = urlGenerator.getRenderURL(p);
                        XMLUtils.createElement(contenthandler, "maximize-uri", link);
                    }
                    if ( !ws.equals(WindowStates._maximized)
                          && ArrayUtils.contains(supportedWindowStates, WindowStates._maximized)) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.WINDOW_STATE, WindowStates._maximized);

                        final String link = urlGenerator.getRenderURL(p);                       
                        XMLUtils.createElement(contenthandler, "fullscreen-uri", link);
                    }

                    String[] supportedModes = (String[])copletInstanceData.getTemporaryAttribute(WSRPAdapter.ATTRIBUTE_NAME_PORTLET_MODES);
                    String pm = windowSession.getMode();
                    if ( pm == null ) {
                        pm = Modes._view;
                    }
                    if ( !pm.equals(Modes._edit)
                         && ArrayUtils.contains(supportedModes, Modes._edit) ) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.PORTLET_MODE, Modes._edit);

                        final String link = urlGenerator.getRenderURL(p);                       
                        XMLUtils.createElement(contenthandler, "edit-uri", link);                   
                    }
                    if ( !pm.equals(Modes._help)
                        && ArrayUtils.contains(supportedModes, Modes._help) ) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.PORTLET_MODE, Modes._help);

                        final String link = urlGenerator.getRenderURL(p);                       
                        XMLUtils.createElement(contenthandler, "help-uri", link);                   
                    }               
                    if ( !pm.equals(Modes._view)
                        && ArrayUtils.contains(supportedModes, Modes._view) ) {
                        final Map p = new HashMap();
                        p.put(Constants.URL_TYPE, Constants.URL_TYPE_RENDER);
                        p.put(Constants.PORTLET_MODE, Modes._view);

                        final String link = urlGenerator.getRenderURL(p);                       
                        XMLUtils.createElement(contenthandler, "view-uri", link);                   
                    }
                }
            } catch (WSRPException ignore) {
                // we ignore this
View Full Code Here

Examples of org.jahia.services.render.URLGenerator

            logger.error("Error when getting site id", e);
        }

        // put live workspace url
        if (request.getAttribute("url") != null) {
            URLGenerator url = (URLGenerator) request.getAttribute("url");
            params.put(JahiaGWTParameters.BASE_URL, url.getContext() + url.getBase());
            params.put(JahiaGWTParameters.STUDIO_URL, url.getContext() + url.getStudio());
            addLanguageSwitcherLinks(renderContext, params, url);
        } else {
            params.put(JahiaGWTParameters.BASE_URL, request.getContextPath().equals("/") ? "" : request.getContextPath() + Render.getRenderServletPath() + "/" + params.get("workspace"+ "/" + locale.toString());
        }
View Full Code Here

Examples of org.jahia.services.render.URLGenerator

import javax.jcr.RepositoryException;

public class SiteParameterAdder implements HtmlTagAttributeVisitor {

    public String visit(String value, RenderContext context, Resource resource) {
        URLGenerator urlGenerator = context.getURLGenerator();
        if (value != null && value.startsWith(urlGenerator.getContext() + urlGenerator.getBase())) {
                if (!value.startsWith(urlGenerator.getContext() + urlGenerator.getBase() + "/sites/") && !value.contains("jsite=")) {
                    String jsite = context.getRequest().getParameter("jsite");
                    if (jsite == null) {
                        jsite = (String) context.getMainResource().getModuleParams().get("jsite");
                    }
                    if (jsite == null) {
View Full Code Here

Examples of org.jahia.services.render.URLGenerator

            JCRNodeWrapper homeNode = session
                    .getNode(FIRST_SITECONTENT_ROOT_NODE + "/home");
            Resource resource = new Resource(homeNode, "html", null, Resource.CONFIGURATION_PAGE);
            context.setMainResource(resource);
            context.setSite(homeNode.getResolveSite());
            new URLGenerator(context, resource);

            SearchCriteria criteria = new SearchCriteria();

            CommaSeparatedMultipleValue oneSite = new CommaSeparatedMultipleValue();
            oneSite.setValue(FIRST_TESTSITE_NAME);
View Full Code Here

Examples of org.jahia.services.render.URLGenerator

            JCRNodeWrapper homeNode = session
                    .getNode(FIRST_SITECONTENT_ROOT_NODE + "/home");
            Resource resource = new Resource(homeNode, "html", null, Resource.CONFIGURATION_PAGE);
            context.setMainResource(resource);
            context.setSite(homeNode.getResolveSite());
            new URLGenerator(context, resource);

            SearchCriteria criteria = new SearchCriteria();

            CommaSeparatedMultipleValue oneSite = new CommaSeparatedMultipleValue();
            oneSite.setValue(FIRST_TESTSITE_NAME);
View Full Code Here

Examples of org.jahia.services.render.URLGenerator

            JCRNodeWrapper homeNode = session
                    .getNode(FIRST_SITECONTENT_ROOT_NODE + "/home");
            Resource resource = new Resource(homeNode, "html", null, Resource.CONFIGURATION_PAGE);
            context.setMainResource(resource);
            context.setSite(homeNode.getResolveSite());
            new URLGenerator(context, resource);

            SearchCriteria criteria = new SearchCriteria();

            CommaSeparatedMultipleValue oneSite = new CommaSeparatedMultipleValue();
            oneSite.setValue(FIRST_TESTSITE_NAME);
View Full Code Here

Examples of org.jahia.services.render.URLGenerator

            JCRNodeWrapper homeNode = session
                    .getNode(FIRST_SITECONTENT_ROOT_NODE + "/home");
            Resource resource = new Resource(homeNode, "html", null, Resource.CONFIGURATION_PAGE);
            context.setMainResource(resource);
            context.setSite(homeNode.getResolveSite());
            new URLGenerator(context, resource);

            SearchCriteria criteria = new SearchCriteria();

            CommaSeparatedMultipleValue oneSite = new CommaSeparatedMultipleValue();
            oneSite.setValue(FIRST_TESTSITE_NAME);
View Full Code Here

Examples of org.jahia.services.render.URLGenerator

            JCRNodeWrapper homeNode = session
                    .getNode(SECOND_SITECONTENT_ROOT_NODE + "/home");
            Resource resource = new Resource(homeNode, "html", null, Resource.CONFIGURATION_PAGE);
            context.setMainResource(resource);
            context.setSite(homeNode.getResolveSite());
            new URLGenerator(context, resource);

            SearchCriteria criteria = new SearchCriteria();

            CommaSeparatedMultipleValue twoSites = new CommaSeparatedMultipleValue();
            twoSites.setValue(FIRST_TESTSITE_NAME + "," + SECOND_TESTSITE_NAME);
View Full Code Here

Examples of org.jahia.services.render.URLGenerator

        chain.pushAttribute(request, "currentResource", resource);
        chain.pushAttribute(request, "currentUser", context.getMainResource().getNode().getSession().getUser());
        chain.pushAttribute(request, "currentAliasUser", context.getMainResource().getNode().getSession().getAliasedUser());
        if (!Resource.CONFIGURATION_INCLUDE.equals(resource.getContextConfiguration())) {
            chain.pushAttribute(request, "currentNode", node);
            chain.pushAttribute(request, "url", new URLGenerator(context, resource));
        }

        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.