Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: MODIFIED: util ...

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

CVS update: MODIFIED: util ...

Author anoncvs
Full name anonymous CVS access
Date 2001-05-04 20:16:40 PDT
Message User: jrobbins
  Date: 01/05/04 20:16:40

  Modified: java/org/joist/util Tag: TIGRIS_1_0 URL.java
  Log:
  buddying MSs change from head to branch
  
  Revision Changes Path
  No revision
  
  http://joist.tigris.​org/source/browse/jo​ist/java/org/joist/u​til/Tag:
  No revision
  
  http://joist.tigris.​org/source/browse/jo​ist/java/org/joist/u​til/TIGRIS_1_0
  1.32.6.2 +71 -1 joist/java/org/joist​/util/URL.java
  
  http://joist.tigris.​org/source/browse/jo​ist/java/org/joist/u​til/URL.java.diff?r1​=1.32.6.1&r2=1.3​2.6.2
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: URL.java
  ====================​====================​====================​=======
  RCS file: /usr/local/tigris/da​ta/helm/cvs/reposito​ry/joist/java/org/jo​ist/util/URL.java,v
  retrieving revision 1.32.6.1
  retrieving revision 1.32.6.2
  diff -u -b -r1.32.6.1 -r1.32.6.2
  --- URL.java 2001/04/24 20:49:43 1.32.6.1
  +++ URL.java 2001/05/05 03:16:40 1.32.6.2
  @@ -65,7 +65,7 @@
    *
    * @author David C. Pellegrini <A HREF="mailto:davidp@​dataweb-systems.com"​>davidp@dataweb-s​ystems.com</A>​
    * @author <a href="mailto:dlr@col​lab.net">Daniel Rall</a>
  - * @version $Id: URL.java,v 1.32.6.1 2001/04/24 20:49:43 dlr Exp $
  + * @version $Id: URL.java,v 1.32.6.2 2001/05/05 03:16:40 jrobbins Exp $
    *
    * Copyright (c) 1999 dataweb systems, inc.
    * Copyright (c) 1999-2001 CollabNet, Inc.
  @@ -128,6 +128,18 @@
        */
       private static final boolean DEBUG = true;
   
  + // URL % HEX HEX values that need escaping
  + public static final String URL_SPACE = "%20";
  + public static final String URL_EXCLAM = "%21";
  + public static final String URL_DBL_QUOTE = "%22";
  + public static final String URL_POUND = "%23";
  + public static final String URL_DOLLAR = "%24";
  + public static final String URL_PERCENT = "%25";
  + public static final String URL_AMPERSAND = "%26";
  + public static final String URL_SINGLE_QUOTE = "%27";
  + public static final String URL_LEFT_PAREN = "%28";
  + public static final String URL_RIGHT_PAREN = "%29";
  +
       /**
        * Tests for inclusion of a protocol in the specified URL. Useful when
        * determining whether or not a URL is local.
  @@ -370,6 +382,64 @@
       if (queryString != null) url.append('?').appe​nd(queryString);
   
           return url.toString();
  + }
  +
  + /**
  + * Converts characters to their %xx equivalent
  + *
  + * @param String to convert
  + * @return String with converted values
  + */
  + public static String encode (String unclean)
  + {
  + StringBuffer clean = new StringBuffer(unclean.length());
  + char[] uncleanChars = unclean.toCharArray();
  + for (int i = 0; i < uncleanChars.length; i++)
  + {
  + switch(uncleanChars[i])
  + {
  + case ' ':
  + clean.append(URL_SPACE);
  + break;
  + case '!':
  + clean.append(URL_EXCLAM);
  + break;
  + case '"':
  + clean.append(URL_DBL_QUOTE);
  +
  + case '#':
  + clean.append(URL_POUND);
  + break;
  +
  + case '$':
  + clean.append(URL_DOLLAR);
  + break;
  +
  + case '%':
  + clean.append(URL_PERCENT);
  + break;
  +
  + case '&':
  + clean.append(URL_AMPERSAND);
  + break;
  +
  + case '\'':
  + clean.append(URL_SINGLE_QUOTE);
  + break;
  +
  + case '(':
  + clean.append(URL_LEFT_PAREN);
  + break;
  +
  + case ')':
  + clean.append(URL_RIGHT_PAREN);
  + break;
  +
  + default:
  + clean.append(uncleanChars[i]);
  + }
  + }
  + return clean.toString();
       }
   
   }
  
  
  

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@jois​t.tigris.org
For additional commands, e-mail: cvs-help at joist dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: MODIFIED: util ... anoncvs anonymous CVS access 2001-05-04 20:16:40 PDT
Messages per page: