Examples of DynamicURI


Examples of org.apache.turbine.util.DynamicURI

            }

            user.setHasLoggedIn( Boolean.FALSE);
            data.setUser(user);
            DynamicURI url = new DynamicURI(data);

            //build body via template
            StringWriter email_body = new StringWriter();

            Context context = TurbineVelocity.getContext(data);
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

        root.addElement( new BR() );
       
        UL ul = new UL();
        //FIXME: the getReason() call has to be escaped from HTML markup, CR&LF
        DynamicURI uri = new DynamicURI( rundata );
       
        ParameterParser params = rundata.getParameters();
        uri.addQueryData( params );
       
        Iterator i = urls.iterator();
       
        while ( i.hasNext() ) {
            URLInfo info = URLManager.getInfo( (String)i.next() );
            /* It can happen that url is no longer in list while
               we are processing */
            if( info != null ) {
                uri.removeQueryData( RETRY_URL );
                uri.addQueryData(RETRY_URL, info.getURL());
                ul.addElement( new LI()
                    .addElement( new A(uri.toString() )
                        .addElement( info.getURL() ) )
                    .addElement( new B( info.getMessage() ) ) );
            }
        }
       
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

        }
        catch (Throwable t)
        {
            t.printStackTrace();
        }
        return new DynamicURI();

    }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

    {
        String uriPathType = null;
        String uriPathElement = null;
        try
        {
            DynamicURI uri = getRoot();

            // Set Group/Role/User in path
            switch (rootType)
            {
                case JetspeedLink.DEFAULT:
                case JetspeedLink.CURRENT:
                    break;
                case JetspeedLink.GROUP:
                    uriPathType = Profiler.PARAM_GROUP;
                    break;
                case JetspeedLink.ROLE:
                    uriPathType = Profiler.PARAM_ROLE;
                    break;
                case JetspeedLink.USER:
                    uriPathType = Profiler.PARAM_USER;
                    break;
            }

            if (rootType != JetspeedLink.CURRENT)
            {
                // Cleanup URI
                uri.removePathInfo(Profiler.PARAM_GROUP);
                uri.removePathInfo(Profiler.PARAM_ROLE);
                uri.removePathInfo(Profiler.PARAM_USER);

                if ((rootType != JetspeedLink.DEFAULT) && (rootValue != null) && (rootValue.trim().length() > 0))
                {
                    uri.addPathInfo(uriPathType, rootValue);
                }
            }

            // Set Page in path
            if (pageName != null)
            {
                uri.removePathInfo(Profiler.PARAM_PAGE);
                if (pageName.trim().length() > 0)
                {
                    uri.addPathInfo(Profiler.PARAM_PAGE, pageName);
                }
            }

            // Set Portlet/Pane in path
            switch (elementType)
            {
                case JetspeedLink.CURRENT:
                case JetspeedLink.DEFAULT:
                    break;
                case JetspeedLink.PANE_ID:
                    uriPathElement = JetspeedResources.PATH_PANEID_KEY;
                    break;
                case JetspeedLink.PANE_NAME:
                    uriPathElement = JetspeedResources.PATH_PANENAME_KEY;
                    break;
                case JetspeedLink.PORTLET_ID:
                    uriPathElement = JetspeedResources.PATH_PORTLETID_KEY;
                    break;
                case JetspeedLink.PORTLET_NAME:
                    uriPathElement = JetspeedResources.PATH_PORTLET_KEY;
                    break;
                case JetspeedLink.PORTLET_ID_QUERY:
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("BaseJetspeedLink: elementValue = " + elementValue);
                    }
                    uriPathElement = JetspeedResources.PATH_PORTLETID_KEY;
                    ProfileLocator baseLocator = Profiler.createLocator();
                    Profile baseProfile = null;
                    switch (rootType)
                    {
                        case JetspeedLink.DEFAULT:
                            break;
                        case JetspeedLink.CURRENT:
                            baseProfile = rundata.getProfile();
                            break;
                        case JetspeedLink.GROUP:
                            baseLocator.setGroupByName(rootValue);
                            break;
                        case JetspeedLink.ROLE:
                            baseLocator.setRoleByName(rootValue);
                            break;
                        case JetspeedLink.USER:
                            try
                            {
                                if (logger.isDebugEnabled())
                                {
                                    logger.debug("BaseJetspeedLink: rootValue user = " + rootValue);
                                }
                                baseLocator.setUser(org.apache.jetspeed.services.JetspeedSecurity.getUser(rootValue));
                            }
                            catch (Exception se)
                            {
                                logger.error("Exception",  se);
                                return null;
                            }
                            break;
                    }
                   
                    if ((rootType != JetspeedLink.CURRENT) && (rootType != JetspeedLink.DEFAULT))
                    {
                        if (mediaType != null && mediaType.length() > 0)
                        {
                            baseLocator.setMediaType(mediaType);
                        }
                        if (language != null && language.length() > 0)
                        {
                            baseLocator.setLanguage(language);
                        }
                        if (country != null && country.length() > 0)
                        {
                            baseLocator.setCountry(country);
                        }
                        if (pageName != null && pageName.length() > 0)
                        {
                            baseLocator.setName(pageName);
                        }
                        baseProfile = Profiler.getProfile(baseLocator);
                    }
                  
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("BaseJetspeedLink: baseLocator = " + baseLocator.getPath());
                    }

                    if ((baseProfile != null) && (elementValue != null))
                    {
                        if (logger.isDebugEnabled())
                        {
                           logger.debug("BaseJetspeedLink: baseProfile = " + baseProfile.toString());
                        }
                        if (baseProfile.getDocument() != null)
                        {
                            if (logger.isDebugEnabled())
                            {
                                logger.debug("BaseJetspeedLink: baseProfile.getDocment() = " + baseProfile.getDocument());
                            }
                            Entry entry = baseProfile.getDocument().getEntry(elementValue);
                            if (entry != null)
                            {
                                if (logger.isDebugEnabled())
                                {
                                    logger.debug("BaseJetspeedLink: entry id = " + entry.getId());
                                }
                                elementValue = entry.getId();
                            }
                            else
                            {
                                elementValue = null;
                            }
                        }
                    }

                    break;
            }

            if (elementType != JetspeedLink.CURRENT)
            {
                // Remove Group/Role/User in URI
                uri.removePathInfo(JetspeedResources.PATH_PANEID_KEY);
                uri.removePathInfo(JetspeedResources.PATH_PANENAME_KEY);
                uri.removePathInfo(JetspeedResources.PATH_PORTLETID_KEY);
                uri.removePathInfo(JetspeedResources.PATH_PORTLET_KEY);

                if ((elementType != JetspeedLink.DEFAULT) && (elementValue != null) && (elementValue.length() > 0))
                {
                    uri.addPathInfo(uriPathElement, elementValue);
                }
            }

            // Set Template in path
            if (templateName != null)
            {
                uri.removePathInfo(JetspeedResources.PATH_TEMPLATE_KEY);
                if (templateName.length() > 0)
                {
                    uri.addPathInfo(JetspeedResources.PATH_TEMPLATE_KEY, templateName);
                }
            }

            // Set Action in path
            if (actionName != null)
            {
                uri.removeQueryData(JetspeedResources.PATH_ACTION_KEY);
                if (actionName.length() > 0)
                {
                    uri.addQueryData(JetspeedResources.PATH_ACTION_KEY, actionName);
                }
            }

            // Set MediaType in path
            if (mediaType != null)
            {
                uri.removePathInfo(Profiler.PARAM_MEDIA_TYPE);
                if (mediaType.length() > 0)
                {
                    uri.addPathInfo(Profiler.PARAM_MEDIA_TYPE, mediaType);
                }
            }

            // Set Language in path
            if (language != null)
            {
                uri.removePathInfo(Profiler.PARAM_LANGUAGE);
                if (language.length() > 0)
                {
                    uri.addPathInfo(Profiler.PARAM_LANGUAGE, language);
                }
            }

            // Set Country in path
            if (country != null)
            {
                uri.removePathInfo(Profiler.PARAM_COUNTRY);
                if (country.length() > 0)
                {
                    uri.addPathInfo(Profiler.PARAM_COUNTRY, country);
                }
            }

            return uri;
        }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

     * @throws ProfileException if the profile detects an error
     * @return  URI to the root portlet/pane
     */
    protected DynamicURI getRoot() throws ProfileException
    {
        DynamicURI uri = null;
        initLink();
        if (locator != null)
        {
            uri = Profiler.makeDynamicURI(rundata, locator);
        }

        if (uri == null)
        {
            uri = new DynamicURI(rundata);
        }

        // check if we need to force to a secure (https) link
        if (JetspeedResources.getBoolean("force.ssl", false))
        {
            uri.setSecure();
        }

        return uri;
    }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

        // bring logged on user to homepage via HTTP redirect
       
        try
        {
            JetspeedLink jsLink = JetspeedLinkFactory.getInstance(data);
            DynamicURI duri = jsLink.getLink(JetspeedLink.CURRENT,null,null,JetspeedLink.CURRENT,null);
            String mtype = data.getParameters().getString("mtype");
            if (mtype != null)
            {
                jsLink.setMediaType(mtype);
                duri = jsLink.addQueryData("mtype", mtype);
                duri = duri.addPathInfo("media-type", mtype);
                String language = data.getParameters().getString("language");
                if(language != null)
                {
                  duri = duri.addQueryData("language",language);
                  String country = data.getParameters().getString("country");
                  if(country != null)
                  {
                    duri = duri.addQueryData("country", country);
                  }
                }
            }
           
            data.setRedirectURI(duri.toString());
            JetspeedLinkFactory.putInstance(jsLink);
          jsLink = null;
        }
        catch (Exception e)
        {
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

     * @param portletName the name of the portlet to link to
     * @return a DynamicURI referencing the named portlet for easy link construction in template
     */
    public DynamicURI setPortletByName(String portletName)
    {
        DynamicURI uri = null;
        try
        {
            uri = getRoot();
        }
        catch (Exception e)
        {
            logger.error("Exception",  e);
            return null;
        }
        if ((portletName != null) && (portletName.length() > 0))
        {
            uri.addPathInfo(JetspeedResources.PATH_PORTLET_KEY, portletName);
        }
        return uri;
    }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

    private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(SendConfirmationEmail.class.getName());   
   
    public void doPerform( RunData data ) throws Exception
    {
        JetspeedUser user = JetspeedSecurity.getUser(data.getParameters().getString("username", ""));       
        DynamicURI url = new DynamicURI(data)
            .addPathInfo(JetspeedResources.PATH_TEMPLATE_KEY, "ConfirmRegistration")
            .addPathInfo("username", user.getUserName())
            .addPathInfo("secretkey", user.getConfirmed())
            .addPathInfo("password", user.getPassword());
        try
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

    */

    public static DynamicURI getPortletEditURI( Portlet portlet,
                                                RunData data) {

        DynamicURI uri = new DynamicURI( data, "Info" );
        uri.addPathInfo( "portlet", portlet.getName() );

        return uri;

    }
View Full Code Here

Examples of org.apache.turbine.util.DynamicURI

    Get a URL for viewing this URL full screen. This is the only method that
    will work if the user has disabled cookies.
    */
    public static DynamicURI getPortletMaxURI( RegistryEntry entry, RunData data ) {

        DynamicURI uri = new DynamicURI( data );

        uri.addPathInfo( "portlet", entry.getName() );

        return uri;

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