portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sg...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal PortletURIManager.java
Date Mon, 09 Apr 2001 22:55:35 GMT
sgala       01/04/09 15:55:35

  Modified:    src/java/org/apache/jetspeed/util URILookup.java
                        URIEncoder.java
               src/java/org/apache/jetspeed/portal PortletURIManager.java
  Log:
  Tried to fix a problem when Portlet names contained _ and spoiled it. Now undone and solved
repairing URIEncode instead.
  
  Revision  Changes    Path
  1.12      +16 -15    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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- URILookup.java	2001/03/12 09:59:59	1.11
  +++ URILookup.java	2001/04/09 22:55:35	1.12
  @@ -68,8 +68,6 @@
   //java imports
   import java.util.Enumeration;
   import java.util.Hashtable;
  -import java.net.URLEncoder;
  -import java.net.URLDecoder;
   
   
   /**
  @@ -121,7 +119,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.11 2001/03/12 09:59:59 ingo Exp $
  + * @version $Id: URILookup.java,v 1.12 2001/04/09 22:55:35 sgala Exp $
    */
   
   public class URILookup {
  @@ -369,7 +367,7 @@
                   DynamicURI uri = new DynamicURI( rundata );
                   uri.setAction( ACTION_MARKPAGE );
                   uri.addPathInfo( "portlet", 
  -                                 URLEncoder.encode( aPortletName ) );
  +                                 URIEncoder.encode( aPortletName ) );
                   newURI = uri.toString();
               }
               else if (aSubType==SUBTYPE_LOGOUT) {
  @@ -400,7 +398,7 @@
                   DynamicURI uri = new DynamicURI( rundata,
                                                    SCREEN_INFO );
                   uri.addPathInfo( "portlet", 
  -                                 URLEncoder.encode( aPortletName ) );
  +                                 URIEncoder.encode( aPortletName ) );
                   newURI = uri.toString();
               }
               else if (aSubType==SUBTYPE_MARK) {
  @@ -411,7 +409,7 @@
                                                    SCREEN_INFO,
                                                    ACTION_MARKPAGE );
                   uri.addPathInfo( "portlet", 
  -                                 URLEncoder.encode( aPortletName ) );
  +                                 URIEncoder.encode( aPortletName ) );
                   newURI = uri.toString();
               }
               else {
  @@ -435,7 +433,7 @@
                   //         But I think this branch is never used anyway. (?)
                   DynamicURI uri = new DynamicURI( rundata, SCREEN_EDIT_ACCOUNT, ACTION_MARKPAGE
);
                   uri.addPathInfo( "portlet", 
  -                                 URLEncoder.encode( aPortletName ) );
  +                                 URIEncoder.encode( aPortletName ) );
                   newURI = uri.toString();
               }
               else {
  @@ -449,7 +447,7 @@
                   DynamicURI uri = new DynamicURI( rundata, SCREEN_CUSTOMIZE );
                   if( aPortletName != null ) {
                       uri.addPathInfo( "portlet", 
  -                                     URLEncoder.encode( aPortletName ) );
  +                                     URIEncoder.encode( aPortletName ) );
                   }
                   newURI = uri.toString();
               }
  @@ -459,7 +457,7 @@
                   DynamicURI uri = new DynamicURI( rundata, SCREEN_CUSTOMIZE );
                   if( aPortletName != null ) {
                       uri.addPathInfo( "portlet", 
  -                                     URLEncoder.encode( aPortletName ) );
  +                                     URIEncoder.encode( aPortletName ) );
                   }
                   uri.setAction( ACTION_CUSTOMIZER_SAVE );
                   newURI = uri.toString();
  @@ -553,7 +551,7 @@
           if (aPortlet!=null) {
               aPortlet = getRealPortlet(aPortlet);
   
  -            if (URLEncoder.encode(aPortlet.getName())
  +            if (URIEncoder.encode(aPortlet.getName())
                       .equals(rundata.getParameters().getString("portlet"))) {
                   if (rundata.getScreen()!=null) {
                       if (rundata.getScreen().equals(SCREEN_INFO)) return TYPE_INFO;
  @@ -601,7 +599,7 @@
           
           aPortlet = getRealPortlet(aPortlet);
   
  -        if (URLEncoder.encode(aPortlet.getName())
  +        if (URIEncoder.encode(aPortlet.getName())
               .equals(rundata.getParameters().getString("portlet"))) {
   
               if ((rundata.getScreen()==null) || // no screen
  @@ -722,7 +720,10 @@
                   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
  -                        markedPage = markedPage.substring(idx);
  +                        idx = markedPage.indexOf("/",idx+1); // search the next slash
  +                        if (idx!=-1) { // this is the slash after context
  +                            markedPage = markedPage.substring(idx);
  +                        }
                       }
                   }
               }
  @@ -743,7 +744,7 @@
       */
       public static final PortletEntry getEntry( ParameterParser params ) throws Exception
{
   
  -            String name = URLDecoder.decode( params.getString( "portlet" ) );
  +            String name = URIEncoder.decode( params.getString( "portlet" ) );
   
           return (PortletEntry)RegistryManager.getEntry(RegistryManager.PORTLET_REGISTRY,
name );
   
  @@ -816,8 +817,8 @@
        */
       private static String addURIParameter( String uri, String parameter, String value)
       {
  -        parameter = URLEncoder.encode( parameter );
  -        value = URLEncoder.encode( value );
  +        parameter = URIEncoder.encode( parameter );
  +        value = URIEncoder.encode( value );
           if (uri.indexOf("?")!=-1) {
               int idx = uri.indexOf( parameter + "=", uri.indexOf("?"));
               if (idx!=-1) { // parameter already in URI. remove it
  
  
  
  1.10      +6 -1      jakarta-jetspeed/src/java/org/apache/jetspeed/util/URIEncoder.java
  
  Index: URIEncoder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/URIEncoder.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- URIEncoder.java	2001/03/07 06:50:08	1.9
  +++ URIEncoder.java	2001/04/09 22:55:35	1.10
  @@ -61,7 +61,7 @@
   
   @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
   @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
  -@version $Id: URIEncoder.java,v 1.9 2001/03/07 06:50:08 taylor Exp $
  +@version $Id: URIEncoder.java,v 1.10 2001/04/09 22:55:35 sgala Exp $
   */
   public class URIEncoder {
   
  @@ -156,6 +156,11 @@
   
           String protocol = null;
           
  +        //SGP: needed if uri does not contain protocol but contains "_"
  +        if( uri.charAt( start + 1 ) == '_' ) {
  +            start = -1;
  +        }
  +
           if ( start > -1 ) {
               protocol = uri.substring( 0, start );
           }
  
  
  
  1.32      +4 -6      jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletURIManager.java
  
  Index: PortletURIManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletURIManager.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- PortletURIManager.java	2001/03/30 10:20:21	1.31
  +++ PortletURIManager.java	2001/04/09 22:55:35	1.32
  @@ -72,8 +72,6 @@
   
   //java imports
   import java.util.Enumeration;
  -import java.net.URLEncoder;
  -import java.net.URLDecoder;
   
   /**
   <p>
  @@ -103,7 +101,7 @@
   
   @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
   @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
  -@version $Id: PortletURIManager.java,v 1.31 2001/03/30 10:20:21 sgala Exp $
  +@version $Id: PortletURIManager.java,v 1.32 2001/04/09 22:55:35 sgala Exp $
   */
   
   public class PortletURIManager {
  @@ -130,7 +128,7 @@
                                                   RunData data) {
   
           DynamicURI uri = new DynamicURI( data, "Info" );
  -        uri.addPathInfo( "portlet", URLEncoder.encode( portlet.getName() ) );
  +        uri.addPathInfo( "portlet", URIEncoder.encode( portlet.getName() ) );
   
           return uri;
   
  @@ -145,7 +143,7 @@
   
           DynamicURI uri = new DynamicURI( data );
   
  -        uri.addPathInfo( "portlet", URLEncoder.encode( entry.getName() ) );
  +        uri.addPathInfo( "portlet", URIEncoder.encode( entry.getName() ) );
   
           return uri;
   
  @@ -167,7 +165,7 @@
           //jdk1.2 throws Exception.
           //jdk1.3 does not... :-?
           try {
  -            String name = URLDecoder.decode( params.getString( "portlet" ) );
  +            String name = URIEncoder.decode( params.getString( "portlet" ) );
   
               return (PortletEntry)RegistryManager.getEntry(RegistryManager.PORTLET_REGISTRY,
                                                             name );
  
  
  

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