portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shes...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util URILookup.java
Date Fri, 04 May 2001 11:39:56 GMT
shesmer     01/05/04 04:39:55

  Modified:    src/java/org/apache/jetspeed/util Tag: portlet_api
                        URILookup.java
  Log:
  portlet api 2 implementation
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.12.2.1  +400 -26   jakarta-jetspeed/src/java/org/apache/jetspeed/util/URILookup.java
  
  Index: URILookup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/URILookup.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- URILookup.java	2001/04/09 22:55:35	1.12
  +++ URILookup.java	2001/05/04 11:39:48	1.12.2.1
  @@ -59,6 +59,7 @@
   import org.apache.jetspeed.portal.PortletControl;
   import org.apache.jetspeed.om.registry.peer.PortletEntry;
   import org.apache.jetspeed.services.registrymanager.RegistryManager;
  +import org.apache.jetspeed.capability.*;
   
   //turbine
   import org.apache.jetspeed.services.resources.JetspeedResources;
  @@ -68,6 +69,9 @@
   //java imports
   import java.util.Enumeration;
   import java.util.Hashtable;
  +import java.net.URLEncoder;
  +import java.net.URLDecoder;
  +import javax.servlet.http.HttpSession;
   
   
   /**
  @@ -119,7 +123,7 @@
    * 
    * @author <A HREF="shesmer@raleigh.ibm.com">Stephan Hesmer</A>
    * @author <A HREF="sgala@apache.org">Santiago Gala</A>
  - * @version $Id: URILookup.java,v 1.12 2001/04/09 22:55:35 sgala Exp $
  + * @version $Id: URILookup.java,v 1.12.2.1 2001/05/04 11:39:48 shesmer Exp $
    */
   
   public class URILookup {
  @@ -147,6 +151,18 @@
       public static final int TYPE_INFO               = 1;
   
       /**
  +     * <P>shows the edit page of the portlet</P>
  +     * allowed subtypes:<BR>
  +     * <UL>
  +     * <LI>SUBTYPE_NONE</LI>
  +     * <LI>SUBTYPE_MARK</LI>
  +     * <LI>SUBTYPE_SAVE</LI>
  +     * <LI>SUBTYPE_CANCEL</LI>
  +     * </UL>
  +     */
  +    public static final int TYPE_EDIT_PORTLET       = 2;
  +
  +    /**
        * <P>show the edit page of the account</P>
        * allowed Subtypes:<BR>
        * <UL>
  @@ -192,6 +208,18 @@
       public static final int TYPE_ENROLLMENT         = 7;
   
       /**
  +     * <P>shows the help of a portlet<BR>
  +     * allowed Subtypes:<BR>
  +     * <UL>
  +     * <LI>SUBTYPE_NONE</LI>
  +     * <LI>SUBTYPE_RESTORE</LI>
  +     * <LI>SUBTYPE_MAXIMIZE</LI>
  +     * </UL>
  +     */
  +    public static final int TYPE_HELP               = 8;
  +
  +
  +    /**
        * apply no subtype to the url
        */
       public static final int SUBTYPE_NONE            = 0;
  @@ -220,6 +248,10 @@
        * save user settings before processing portlet
        */
       public static final int SUBTYPE_SAVE            = 6;
  +    /**
  +     * cancels user settings before processing portlet
  +     */
  +    public static final int SUBTYPE_CANCEL          = 7;
   
       /**
        * Gets the URI for the specified type
  @@ -239,6 +271,8 @@
                         aSubType,
                         null,
                         (String)null,
  +                      (String)null,
  +                      (String)null,
                         rundata);
       }
   
  @@ -270,12 +304,14 @@
        * @param aType    type of the URI
        * @param aSubType subtype of the URI
        * @param aPortletName Portlet the URI points to
  +     * @param piid the portlet instance identifier
        * @param rundata  the RunData object
        * @return the URI
        */
       public static String getURI(int aType,
                                   int aSubType,
                                   String aPortletName,
  +                                String piid,
                                   RunData rundata)
           throws JetspeedException
       {
  @@ -283,6 +319,8 @@
                         aSubType,
                         null,
                         aPortletName,
  +                      piid,
  +                      (String)null,
                         rundata);
       }
   
  @@ -310,6 +348,8 @@
                             aSubType,
                             userData,
                             aPortlet.getName(),
  +                          "notImplementedInTheCurrentLayoutSystem",
  +                          (String)null,
                             rundata);
           }
           else {
  @@ -317,6 +357,8 @@
                             aSubType,
                             userData,
                             (String)null,
  +                          (String)null,
  +                          (String)null,
                             rundata);
           }
       }
  @@ -329,6 +371,8 @@
        * @param aSubType subtype of the URI
        * @param userData string which should be added to the URL
        * @param aPortletName Portlet the URI points to
  +     * @param piid the portlet instance identifier
  +     * @param actionReference the action name to be performed by the portlet container
        * @param rundata  the RunData object
        * @return the URI
        */
  @@ -336,6 +380,8 @@
                                   int aSubType,
                                   String userData,
                                   String aPortletName,
  +                                String piid,
  +                                String actionReference,
                                   RunData rundata)
           throws JetspeedException
       {
  @@ -364,10 +410,15 @@
                   propertiesParameter += "maximize.";
                   
                   if (aPortletName==null) throw new JetspeedException( "A portlet is required
to return an URI." );
  +                if (piid==null) throw new JetspeedException( "A piid is required to return
an URI." );
                   DynamicURI uri = new DynamicURI( rundata );
                   uri.setAction( ACTION_MARKPAGE );
                   uri.addPathInfo( "portlet", 
  -                                 URIEncoder.encode( aPortletName ) );
  +                                 URLEncoder.encode( aPortletName ) );
  +                uri.addPathInfo( "piid", 
  +                                 URLEncoder.encode( piid ) );
  +                uri.addPathInfo( "show", 
  +                                 "max" );
                   newURI = uri.toString();
               }
               else if (aSubType==SUBTYPE_LOGOUT) {
  @@ -395,23 +446,62 @@
               
               if (aSubType==SUBTYPE_NONE) {
                   if (aPortletName==null) throw new JetspeedException( "A portlet is required
to return an URI." );
  +                if (piid==null) throw new JetspeedException( "A piid is required to return
an URI." );
                   DynamicURI uri = new DynamicURI( rundata,
                                                    SCREEN_INFO );
                   uri.addPathInfo( "portlet", 
  -                                 URIEncoder.encode( aPortletName ) );
  +                                 URLEncoder.encode( aPortletName ) );
  +                uri.addPathInfo( "piid", 
  +                                 URLEncoder.encode( piid ) );
                   newURI = uri.toString();
               }
               else if (aSubType==SUBTYPE_MARK) {
                   propertiesParameter += "mark.";
   
                   if (aPortletName==null) throw new JetspeedException( "A portlet is required
to return an URI." );
  +                if (piid==null) throw new JetspeedException( "A piid is required to return
an URI." );
                   DynamicURI uri = new DynamicURI( rundata,
                                                    SCREEN_INFO,
                                                    ACTION_MARKPAGE );
                   uri.addPathInfo( "portlet", 
  +                                 URLEncoder.encode( aPortletName ) );
  +                uri.addPathInfo( "piid", 
  +                                 URLEncoder.encode( piid ) );
  +                newURI = uri.toString();
  +            }
  +            else {
  +                throw new JetspeedException( "Incorrect Type / Subtype combination." );
  +            }
  +        }
  +        else if (aType==TYPE_EDIT_PORTLET) {
  +            propertiesParameter += "editportlet.";
  +            
  +            if (aSubType==SUBTYPE_NONE) {
  +                if (aPortletName==null) 
  +                    throw new JetspeedException( "A portlet is required to return an URI."
);
  +                if (piid==null) 
  +                    throw new JetspeedException( "A piid is required to return an URI."
);
  +                DynamicURI uri = new DynamicURI( rundata, SCREEN_EDIT_PORTLET );
  +                uri.addPathInfo( "portlet", 
                                    URIEncoder.encode( aPortletName ) );
  +                uri.addPathInfo( "piid", 
  +                                 URLEncoder.encode( piid ) );
                   newURI = uri.toString();
               }
  +            else if (aSubType==SUBTYPE_MARK) {
  +                propertiesParameter += "mark.";
  +                
  +                if (aPortletName==null) 
  +                    throw new JetspeedException( "A portlet is required to return an URI."
);
  +                if (piid==null) 
  +                    throw new JetspeedException( "A piid is required to return an URI."
);
  +                DynamicURI uri = new DynamicURI( rundata, SCREEN_EDIT_PORTLET, ACTION_MARKPAGE
);
  +                uri.addPathInfo( "portlet", 
  +                                 URIEncoder.encode( aPortletName ) );
  +                uri.addPathInfo( "piid", 
  +                                 URLEncoder.encode( piid ) );
  +                newURI = uri.toString();
  +            }
               else {
                   throw new JetspeedException( "Incorrect Type / Subtype combination." );
               }
  @@ -429,11 +519,14 @@
                   propertiesParameter += "mark.";
                   
                   if (aPortletName==null) throw new JetspeedException( "A portlet is required
to return an URI." );
  +                if (piid==null) throw new JetspeedException( "A piid is required to return
an URI." );
                   // FIX ME: how can we add a prepare action and a mark action at the same
time?
                   //         But I think this branch is never used anyway. (?)
                   DynamicURI uri = new DynamicURI( rundata, SCREEN_EDIT_ACCOUNT, ACTION_MARKPAGE
);
                   uri.addPathInfo( "portlet", 
  -                                 URIEncoder.encode( aPortletName ) );
  +                                 URLEncoder.encode( aPortletName ) );
  +                uri.addPathInfo( "piid", 
  +                                 URLEncoder.encode( piid ) );
                   newURI = uri.toString();
               }
               else {
  @@ -447,7 +540,9 @@
                   DynamicURI uri = new DynamicURI( rundata, SCREEN_CUSTOMIZE );
                   if( aPortletName != null ) {
                       uri.addPathInfo( "portlet", 
  -                                     URIEncoder.encode( aPortletName ) );
  +                                     URLEncoder.encode( aPortletName ) );
  +                    uri.addPathInfo( "piid", 
  +                                     URLEncoder.encode( piid ) );
                   }
                   newURI = uri.toString();
               }
  @@ -457,7 +552,9 @@
                   DynamicURI uri = new DynamicURI( rundata, SCREEN_CUSTOMIZE );
                   if( aPortletName != null ) {
                       uri.addPathInfo( "portlet", 
  -                                     URIEncoder.encode( aPortletName ) );
  +                                     URLEncoder.encode( aPortletName ) );
  +                    uri.addPathInfo( "piid", 
  +                                     URLEncoder.encode( piid ) );
                   }
                   uri.setAction( ACTION_CUSTOMIZER_SAVE );
                   newURI = uri.toString();
  @@ -497,10 +594,97 @@
               TemplateLink link = new TemplateLink( rundata );
               newURI = link.setPage( SCREEN_NEWACCOUNT ).toString();
           }
  +        else if (aType==TYPE_HELP) {
  +            propertiesParameter += "help.";
  +            
  +            if (aSubType==SUBTYPE_NONE) {
  +                if (aPortletName==null) 
  +                    throw new JetspeedException( "A portlet is required to return an URI."
);
  +                if (piid==null) 
  +                    throw new JetspeedException( "A piid is required to return an URI."
);
  +                DynamicURI uri = new DynamicURI( rundata );
  +                uri.addPathInfo( "portlet", 
  +                                 URIEncoder.encode( aPortletName ) );
  +                uri.addPathInfo( "piid", 
  +                                 URLEncoder.encode( piid ) );
  +                uri.addPathInfo( "mode", 
  +                                 "help" );
  +                newURI = uri.toString();
  +            }
  +            else if (aSubType==SUBTYPE_RESTORE) {
  +                propertiesParameter += "restore.";
  +
  +                newURI = getCurrentURI(rundata);
  +                newURI = replaceTurbineURIParameter(newURI, 
  +                                                    "mode", 
  +                                                    "help");
  +                
  +/*
  +                newURI = getMarkedPage( rundata );
  +                if (newURI==null) {
  +                    DynamicURI uri = new DynamicURI( rundata,
  +                                                     SCREEN_HOME );
  +                    uri.addPathInfo( "mode", 
  +                                     "help" );
  +                    newURI = uri.toString();
  +                }
  +*/                
  +            }
  +            else if (aSubType==SUBTYPE_MAXIMIZE) {
  +                propertiesParameter += "maximize.";
  +                if (aPortletName==null) 
  +                    throw new JetspeedException( "A portlet is required to return an URI."
);
  +                if (piid==null) 
  +                    throw new JetspeedException( "A piid is required to return an URI."
);
  +                
  +                newURI = getCurrentURI(rundata);
  +                newURI = replaceTurbineURIParameter(newURI, 
  +                                                    "portlet", 
  +                                                    URLEncoder.encode( aPortletName ));
  +                newURI = replaceTurbineURIParameter(newURI, 
  +                                                    "piid", 
  +                                                    URLEncoder.encode( piid ));
  +                newURI = replaceTurbineURIParameter(newURI, 
  +                                                    "mode", 
  +                                                    "help");
  +                newURI = replaceTurbineURIParameter(newURI, 
  +                                                    "show", 
  +                                                    "max");
  +/*                
  +                DynamicURI uri = new DynamicURI( rundata );
  +                uri.addPathInfo( "portlet", 
  +                                 URLEncoder.encode( aPortletName ) );
  +                uri.addPathInfo( "mode", 
  +                                 "help" );
  +                uri.addPathInfo( "show", 
  +                                 "max" );
  +                newURI = uri.toString();
  +*/                
  +            }
  +            else {
  +                throw new JetspeedException( "Incorrect Type / Subtype combination." );
  +            }
  +        }
           else {
               throw new JetspeedException( "Incorrect Type / Subtype combination." );
           }
   
  +        if (actionReference!=null) { // add action
  +            if (aPortletName==null) throw new JetspeedException( "A portlet is required
to return an URI." );
  +            newURI = replaceTurbineURIParameter(newURI, 
  +                                                "actionPid", 
  +                                                URLEncoder.encode( aPortletName ) );
  +            newURI = replaceTurbineURIParameter(newURI, 
  +                                                "actionPiid", 
  +                                                URLEncoder.encode( piid ));
  +            newURI = replaceTurbineURIParameter(newURI, 
  +                                                "action", 
  +                                                ACTION_DISPATCHER );
  +            newURI = replaceTurbineURIParameter(newURI, 
  +                                                "actionRef", 
  +                                                URIEncoder.encode( actionReference ) );
  +        }
  +
           propertiesParameter += "uri";
           String propertiesParameterValue = JetspeedResources.getString( propertiesParameter,
null );
           if (propertiesParameterValue!=null) {
  @@ -517,12 +701,27 @@
           }
           // adds sessionid if necessary
           newURI = rundata.getResponse().encodeURL( newURI );
  +/* SHESMER-BUGFIX for Applications
           // remove starting slash, so that the URI is relative, and the Base-Tag is used
           // Note: if there is no starting slash, the function encodeURL inserts one slash
in front of the URI
           if (newURI.startsWith("/")) {
               newURI = newURI.substring(1);
           }
  -       return newURI;
  +*/
  +        // special check for WML, because we use relative URLs and WML has no BaseTag
  +        CapabilityMap cm = CapabilityMapFactory.getCapabilityMap( rundata );
  +        if ( cm.getPreferredType().equals( MimeType.WML ) ) {
  +          String ctxtPath = JetspeedResources.getString( JetspeedResources.CONTENT_ROOT_URL_KEY,
"");
  +          try {
  +              ctxtPath = rundata.getRequest().getContextPath()+ctxtPath;
  +          } catch (Exception e) {
  +            // not servlet 2.2
  +          }
  +          if (newURI.startsWith(ctxtPath)) newURI = newURI.substring(ctxtPath.length());
  +          newURI = URILookup.getWebAppBaseDirURI( rundata ) + newURI;
  +        }
  +
  +        return newURI;
       }
   
       /**
  @@ -533,7 +732,7 @@
        */
       public static int getURIType(RunData rundata)
       {
  -        return getURIType( null, rundata );
  +        return getURIType( (String)null, rundata );
       }
   
       /**
  @@ -548,13 +747,41 @@
        */
       public static int getURIType(Portlet aPortlet, RunData rundata)
       {
  +        String aPortletName = null;
           if (aPortlet!=null) {
               aPortlet = getRealPortlet(aPortlet);
  +            aPortletName = aPortlet.getName();
  +        }
  +        return getURIType(aPortletName,rundata);
  +    }
   
  -            if (URIEncoder.encode(aPortlet.getName())
  +    /**
  +     * Gets the type of the URI (e.g. TYPE_INFO, TYPE_EDIT).
  +     * The default return value is TYPE_HOME
  +     * <P>Hint:<BR>
  +     * Portlets should check for TYPE_EDIT_PORTLET and in any other case render the content</P>
  +     * 
  +     * @param aPortlet the associated portlet
  +     * @param rundata  the RunData object
  +     * @return the type
  +     */
  +    public static int getURIType(String aPortletName, RunData rundata)
  +    {
  +        if (aPortletName!=null) {
  +            if (URIEncoder.encode(aPortletName)
                       .equals(rundata.getParameters().getString("portlet"))) {
  +                if (rundata.getScreen()!=null) {
  +                    if (rundata.getScreen().equals(SCREEN_EDIT_PORTLET)) return TYPE_EDIT_PORTLET;
  +                }
  +                String mode = rundata.getParameters().getString("mode");
  +                if (mode!=null) {
  +                    if (mode.equals("help")) return TYPE_HELP;
  +                }
  +            }
  +            else {
                   if (rundata.getScreen()!=null) {
  -                    if (rundata.getScreen().equals(SCREEN_INFO)) return TYPE_INFO;
  +                    if ((URIEncoder.encode(aPortletName).equals("PortletInfoPortlet"))
&&
  +                        (rundata.getScreen().equals(SCREEN_INFO))) return TYPE_INFO;
                   }
               }
           }
  @@ -585,6 +812,28 @@
       public static int getURISubType(Portlet aPortlet, RunData rundata)
           throws JetspeedException
       {
  +        if (aPortlet==null) throw new JetspeedException( "A portlet is required." );
  +        aPortlet = getRealPortlet(aPortlet);
  +
  +        return getURISubType(aPortlet.getName(),rundata);
  +    }
  +
  +    /**
  +     * <P>Gets the subtype of the URI (e.g. SUBTYPE_SAVE).</P>
  +     * returns only the values<BR>
  +     * <UL>
  +     * <LI>SUBTYPE_NONE</LI>
  +     * <LI>SUBTYPE_MAXIMIZE</LI>
  +     * <LI>SUBTYPE_SAVE</LI>
  +     * </UL>
  +     * 
  +     * @param aPortletName the related portlet name
  +     * @param rundata  the RunData object
  +     * @return the type
  +     * @exception JetspeedException
  +     */
  +    public static int getURISubType(String aPortletName, RunData rundata)
  +    {
           if (rundata.getAction()!=null) {
               if (rundata.getAction().equals(ACTION_ACCEPT_LOGIN)) return SUBTYPE_ACCEPT_LOGIN;
               else if (rundata.getAction().equals(ACTION_LOGOUT)) return SUBTYPE_LOGOUT;
  @@ -595,16 +844,20 @@
               if (value.equalsIgnoreCase("save")) return SUBTYPE_SAVE;
           }
   
  -        if (aPortlet==null) throw new JetspeedException( "A portlet is required." );
  -        
  -        aPortlet = getRealPortlet(aPortlet);
  -
  -        if (URIEncoder.encode(aPortlet.getName())
  -            .equals(rundata.getParameters().getString("portlet"))) {
  -
  -            if ((rundata.getScreen()==null) || // no screen
  -                ( SCREEN_HOME.equals(rundata.getScreen())) ) { // or Home-screen
  -                return SUBTYPE_MAXIMIZE;
  +        if (aPortletName!=null) {
  +            if (URLEncoder.encode(aPortletName)
  +                .equals(rundata.getParameters().getString("portlet"))) {
  +
  +                String show = rundata.getParameters().getString("show");
  +                if (show!=null) {
  +                    if (show.equals("max")) return SUBTYPE_MAXIMIZE;
  +                }
  +    /* old source
  +                if ((rundata.getScreen()==null) || // no screen
  +                    ( SCREEN_HOME.equals(rundata.getScreen())) ) { // or Home-screen
  +                    return SUBTYPE_MAXIMIZE;
  +                }
  +    */            
               }
           }
   
  @@ -624,6 +877,41 @@
       }
   
       /**
  +     * Returns the portlet related to the action
  +     * 
  +     * @param rundata the RunData object
  +     * @return the portlet associated with the action
  +     * @see #getURI
  +     */
  +    public static String getURIActionPid(RunData rundata)
  +    {
  +        return rundata.getParameters().getString("actionPid");
  +    }
  +
  +    /**
  +     * Returns the piid related to the action
  +     * 
  +     * @param rundata the RunData object
  +     * @return the piid associated with the action
  +     * @see #getURI
  +     */
  +    public static String getURIActionPiid(RunData rundata)
  +    {
  +        return rundata.getParameters().getString("actionPiid");
  +    }
  +
  +    /**
  +     * Returns the action reference related to the action
  +     * 
  +     * @param rundata the RunData object
  +     * @return the action reference associated with the action
  +     */
  +    public static String getURIActionReference(RunData rundata)
  +    {
  +        return rundata.getParameters().getString("actionRef");
  +    }
  +
  +    /**
        * returns the WebApplication base directory.
        * 
        * @param rundata the rundata object
  @@ -653,6 +941,91 @@
       }
   
       /**
  +     * Returns the URI to the current screen and current
  +     * portlet.
  +     * 
  +     * @param rundata the Rundata object
  +     * @return the URI
  +     */
  +    public static String getCurrentURI(RunData rundata)
  +    {
  +        return getCurrentURI( null, rundata );
  +    }
  +
  +    /**
  +     * Returns the URI to the current screen and current
  +     * portlet. Additionally it adds user data to the URI.
  +     * 
  +     * @param userData user data to be added
  +     * @param rundata  the Rundata object
  +     * @return the URI
  +     */
  +    public static String getCurrentURI(String userData, RunData rundata)
  +    {
  +        DynamicURI uri = new DynamicURI( rundata );
  +        if (rundata.getRequest().getPathInfo()!=null) {
  +            String pathInfo = rundata.getRequest().getPathInfo();
  +
  +            // get the current screen and append it to current uri
  +            int idx = pathInfo.indexOf("/screen/");
  +            if (idx!=-1) {
  +                idx += "/screen/".length();
  +                int idx2 = pathInfo.indexOf("/",idx);
  +                if (idx2==-1) // end of string
  +                  idx2 = pathInfo.length();
  +                uri.setScreen( pathInfo.substring( idx, idx2 ) );
  +            }
  +
  +            // get the current screen and append it to current uri
  +            idx = pathInfo.indexOf("/portlet/");
  +            if (idx!=-1) {
  +                idx += "/portlet/".length();
  +                int idx2 = pathInfo.indexOf("/",idx);
  +                if (idx2==-1) // end of string
  +                  idx2 = pathInfo.length();
  +                uri.addPathInfo( "portlet", URIEncoder.encode( pathInfo.substring( idx,
idx2 ) ) );
  +            }
  +
  +            // get the current mode and append it to current uri
  +            idx = pathInfo.indexOf("/mode/");
  +            if (idx!=-1) {
  +                idx += "/mode/".length();
  +                int idx2 = pathInfo.indexOf("/",idx);
  +                if (idx2==-1) // end of string
  +                  idx2 = pathInfo.length();
  +                uri.addPathInfo( "mode", URIEncoder.encode( pathInfo.substring( idx, idx2
) ) );
  +            }
  +
  +        }
  +        String newURI = uri.toString();
  +
  +        if (userData!=null) newURI = addURIParameter(newURI, userData);
  +
  +        // remove sessionid, if exists
  +        if (newURI.indexOf(";jsessionid")!=-1) {
  +            newURI = newURI.substring(0,newURI.indexOf(";jsessionid"));
  +        }
  +        // adds sessionid if necessary
  +        newURI = rundata.getResponse().encodeURL( newURI );
  +
  +        // special check for WML, because we use relative URLs and WML has no BaseTag
  +        CapabilityMap cm = CapabilityMapFactory.getCapabilityMap( rundata );
  +        if ( cm.getPreferredType().equals( MimeType.WML ) ) {
  +          String ctxtPath = JetspeedResources.getString( JetspeedResources.CONTENT_ROOT_URL_KEY,
"");
  +          try {
  +              ctxtPath = rundata.getRequest().getContextPath()+ctxtPath;
  +          } catch (Exception e) {
  +            // not servlet 2.2
  +          }
  +          if (newURI.startsWith(ctxtPath)) newURI = newURI.substring(ctxtPath.length());
  +
  +          newURI = URILookup.getWebAppBaseDirURI( rundata ) + newURI;
  +        }
  +
  +        return newURI;
  +    }
  +
  +    /**
        * Marks the current URI and stores it internally for later usage.
        *
        * @param rundata the RunData object
  @@ -720,10 +1093,7 @@
                   if (idx!=-1) { // found it
                       idx = markedPage.indexOf("/",idx+3); // search the next slash
                       if (idx!=-1) { // this is the slash after host and port
  -                        idx = markedPage.indexOf("/",idx+1); // search the next slash
  -                        if (idx!=-1) { // this is the slash after context
  -                            markedPage = markedPage.substring(idx);
  -                        }
  +                        markedPage = markedPage.substring(idx);
                       }
                   }
               }
  @@ -744,7 +1114,7 @@
       */
       public static final PortletEntry getEntry( ParameterParser params ) throws Exception
{
   
  -            String name = URIEncoder.decode( params.getString( "portlet" ) );
  +            String name = URLDecoder.decode( params.getString( "portlet" ) );
   
           return (PortletEntry)RegistryManager.getEntry(RegistryManager.PORTLET_REGISTRY,
name );
   
  @@ -817,8 +1187,8 @@
        */
       private static String addURIParameter( String uri, String parameter, String value)
       {
  -        parameter = URIEncoder.encode( parameter );
  -        value = URIEncoder.encode( value );
  +        parameter = URLEncoder.encode( parameter );
  +        value = URLEncoder.encode( value );
           if (uri.indexOf("?")!=-1) {
               int idx = uri.indexOf( parameter + "=", uri.indexOf("?"));
               if (idx!=-1) { // parameter already in URI. remove it
  @@ -853,10 +1223,14 @@
       private static final String SCREEN_LOGIN                       = JetspeedResources.getString(
"screen.login" );
       private static final String SCREEN_NEWACCOUNT                  = "NewAccount";
       private static final String SCREEN_EDIT_ACCOUNT                = "EditAccount";
  +    private static final String SCREEN_EDIT_PORTLET                = "Edit";
   
       private static final String ACTION_MARKPAGE                    = "MarkRefPage";
       private static final String ACTION_LOGOUT                      = "LogoutUser";
       private static final String ACTION_ACCEPT_LOGIN                = JetspeedResources.getString(
"action.login" );
       private static final String ACTION_CUSTOMIZER_SAVE             = "SavePageConfig";
       private static final String ACTION_PREPARE_SCREEN_EDIT_ACCOUNT = "PrepareScreenEditAccount";
  +
  +    private static final String ACTION_DISPATCHER                  = "ActionDispatcher";
  +
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message