abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r592138 - in /incubator/abdera/java/trunk: client/src/main/java/org/apache/abdera/protocol/client/ core/src/main/java/org/apache/abdera/ dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ dependencies/i18n/src/main/java/org/apache/a...
Date Mon, 05 Nov 2007 20:15:12 GMT
Author: jmsnell
Date: Mon Nov  5 12:15:09 2007
New Revision: 592138

URL: http://svn.apache.org/viewvc?rev=592138&view=rev
Log:
Updates to the IRI implementation that improve overall performance. Most of the initialization overhead has been moved into the creation of the Abdera object.

Removed:
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Constants.java
Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/Abdera.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/AbstractScheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/DefaultScheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Escaping.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/FtpScheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpScheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpsScheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IDNA.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Nameprep.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/NameprepCodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Scheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIRI.java
    incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java
    incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java Mon Nov  5 12:15:09 2007
@@ -26,7 +26,7 @@
 
 import javax.activation.MimeType;
 
-import org.apache.abdera.i18n.iri.Constants;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 import org.apache.abdera.i18n.iri.Escaping;
 import org.apache.abdera.protocol.Request;
 import org.apache.abdera.protocol.util.AbstractRequest;
@@ -419,7 +419,7 @@
         slug.indexOf((char)13) > -1)
       throw new IllegalArgumentException(
         Messages.get("SLUG.BAD.CHARACTERS"));
-    setHeader("Slug", Escaping.encode(slug,Constants.ASCIISANSCRLF));
+    setHeader("Slug", Escaping.encode(slug,Profile.ASCIISANSCRLF));
   }
   
   /**

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/Abdera.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/Abdera.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/Abdera.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/Abdera.java Mon Nov  5 12:15:09 2007
@@ -18,6 +18,7 @@
 package org.apache.abdera;
 
 import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Categories;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.Feed;
@@ -93,6 +94,7 @@
     parserFactory = newParserFactory();
     writerFactory = newWriterFactory();
     writer = newWriter();
+    IRI.preinit();  // initializes the IRI stuff to improve performance later
   }
   
   /**

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java Mon Nov  5 12:15:09 2007
@@ -17,11 +17,7 @@
 */
 package org.apache.abdera.i18n.io;
 
-import java.util.BitSet;
-
-import org.apache.abdera.i18n.io.CodepointIterator;
-import org.apache.abdera.i18n.io.InvalidCharacterException;
-import org.apache.abdera.i18n.io.RestrictedCodepointIterator;
+import java.util.Arrays;
 
 /**
  * General utilities for dealing with Unicode characters
@@ -34,65 +30,65 @@
     return d >= 0x000000 && d <= 0x10ffff;
   }
   
-  public static int scanNot(CodepointIterator ci, BitSet set) throws InvalidCharacterException {
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true,true);
+  public static int scanNot(CodepointIterator ci, Profile profile) throws InvalidCharacterException {
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,true,true);
     while (rci.hasNext()) rci.next();
     return rci.position;
   }
   
-  public static int scanNot(char[] array, BitSet set) throws InvalidCharacterException {
+  public static int scanNot(char[] array, Profile profile) throws InvalidCharacterException {
     CodepointIterator ci = CodepointIterator.forCharArray(array);
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true,true);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,true,true);
     while (rci.hasNext()) rci.next();
     return rci.position;
   }
   
-  public static int scan(CodepointIterator ci, BitSet set) throws InvalidCharacterException {
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true);
+  public static int scan(CodepointIterator ci, Profile profile) throws InvalidCharacterException {
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,true);
     while (rci.hasNext()) rci.next();
     return rci.position();
   }
   
-  public static int scan(char[] array, BitSet set) throws InvalidCharacterException {
+  public static int scan(char[] array, Profile profile) throws InvalidCharacterException {
     CodepointIterator ci = CodepointIterator.forCharArray(array);
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,true);
     while (rci.hasNext()) rci.next();
     return rci.position();
   }
   
-  public static int scan(String s, BitSet set) throws InvalidCharacterException {
+  public static int scan(String s, Profile profile) throws InvalidCharacterException {
     CodepointIterator ci = CodepointIterator.forCharSequence(s);
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,true);
     while (rci.hasNext()) rci.next();
     return rci.position;
   }
   
-  public static void verifyNot(CodepointIterator ci, BitSet set) throws InvalidCharacterException {
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false,true);
+  public static void verifyNot(CodepointIterator ci, Profile profile) throws InvalidCharacterException {
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,false,true);
     while (rci.hasNext()) rci.next();
   }
   
-  public static void verifyNot(char[] array, BitSet set) throws InvalidCharacterException {
+  public static void verifyNot(char[] array, Profile profile) throws InvalidCharacterException {
     CodepointIterator ci = CodepointIterator.forCharArray(array);
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false,true);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,false,true);
     while (rci.hasNext()) rci.next();
   }
   
-  public static void verify(CodepointIterator ci, BitSet set) throws InvalidCharacterException {
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false);
+  public static void verify(CodepointIterator ci, Profile profile) throws InvalidCharacterException {
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,false);
     while (rci.hasNext()) rci.next();
   }
   
-  public static void verify(char[] array, BitSet set) throws InvalidCharacterException {
+  public static void verify(char[] array, Profile profile) throws InvalidCharacterException {
     CodepointIterator ci = CodepointIterator.forCharArray(array);
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,false);
     while (rci.hasNext()) rci.next();
   }
   
-  public static void verify(String s, BitSet set) throws InvalidCharacterException {
+  public static void verify(String s, Profile profile) throws InvalidCharacterException {
     if (s == null) return;
     CodepointIterator ci = CodepointIterator.forCharSequence(s);
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,profile,false);
     while (rci.hasNext()) rci.next();
   }
   
@@ -113,11 +109,13 @@
     return true;
   }
   
-  public static boolean isSet(int n, BitSet... sets) {
+  public static boolean inRange(int codepoint, int low, int high) {
+    return codepoint >= low && codepoint <= high;
+  }
+  
+  public static boolean isSet(int n, int[]... sets) {
     if (n == -1) return false;
-    BitSet set = new BitSet();
-    for (BitSet s : sets) set.or(s);
-    return set.get(n);
+    return contains(n,sets);
   }
   
   public static void append(StringBuffer buf, int c) {
@@ -327,4 +325,458 @@
   public static String bidiLRM(String s) {
     return wrap(s,LRM,LRM);
   }
+  
+  public static boolean contains(int v, int[]... ranges) {
+    for (int[] range : ranges) 
+      if (Arrays.binarySearch(range, v) > -1) return true;
+    return false;
+  }
+  
+  public static interface Check {
+    boolean escape(int codepoint);
+  }
+  
+  public static enum Profile {
+    NONE(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return true;
+        }
+      }
+    ),
+    ALPHA(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !isAlpha(codepoint);
+        }
+      }
+    ),
+    ALPHANUM(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !isAlphaNum(codepoint);
+        }
+      }
+    ),
+    FRAGMENT(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !isFragment(codepoint);
+        }
+      }
+    ),
+    IFRAGMENT(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_ifragment(codepoint);
+        }
+      }
+    ),
+    PATH(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !isPath(codepoint);
+        }
+      }
+    ),
+    IPATH(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_ipath(codepoint);
+        }
+      }
+    ),
+    IUSERINFO(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_iuserinfo(codepoint);
+        }
+      }
+    ),
+    USERINFO(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !isUserInfo(codepoint);
+        }
+      }
+    ),
+    QUERY(
+        new Check() {
+        public boolean escape(int codepoint) {
+          return !isQuery(codepoint);
+        }
+      }
+    ),
+    IQUERY(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_iquery(codepoint);
+        }
+      }
+    ),
+    SCHEME(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !isScheme(codepoint);
+        }
+      }
+    ),
+    PATHNODELIMS(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !isPathNoDelims(codepoint);
+        }
+      }
+    ),
+    IPATHNODELIMS(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_ipathnodelims(codepoint);
+        }
+      }
+    ),
+    IREGNAME(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_iregname(codepoint);
+        }
+      }
+    ),
+    IPRIVATE(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_iprivate(codepoint);
+        }
+      }
+    ),
+    RESERVED(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !isReserved(codepoint);
+        }
+      }
+    ),
+    IUNRESERVED(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_iunreserved(codepoint);
+        }
+      }
+    ),
+    SCHEMESPECIFICPART(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_iunreserved(codepoint) && 
+                 !isReserved(codepoint) && 
+                 !is_iprivate(codepoint) && 
+                 !isPctEnc(codepoint) && 
+                 codepoint != '#';
+        }
+      }
+    ),
+    AUTHORITY(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !is_regname(codepoint) &&
+                 !isUserInfo(codepoint) && 
+                 !isGenDelim(codepoint);
+        }
+      }
+    ),
+    ASCIISANSCRLF(
+      new Check() {
+        public boolean escape(int codepoint) {  
+          return !CharUtils.inRange(codepoint,1,9) &&   
+                 !CharUtils.inRange(codepoint,14,127);
+        }        
+      }
+    ),
+    STD3ASCIIRULES(
+      new Check() {
+        public boolean escape(int codepoint) {
+          return !CharUtils.inRange(codepoint,0x0000,0x002C) &&
+                 !CharUtils.inRange(codepoint,0x002E,0x002F) &&
+                 !CharUtils.inRange(codepoint,0x003A,0x0040) &&
+                 !CharUtils.inRange(codepoint,0x005B,0x0060) &&
+                 !CharUtils.inRange(codepoint,0x007B,0x007F);          
+        }
+      }
+    )
+    ;
+    private final Check check;
+    Profile(Check check) {
+      this.check = check;
+    }
+    public boolean check(int codepoint) {
+      return check.escape(codepoint);
+    }
+  }
+  
+  public static boolean isDigit(int codepoint) {
+    return CharUtils.inRange(codepoint, '0', '9');
+  }
+  
+  public static boolean isAlpha(int codepoint) {
+    return CharUtils.inRange(codepoint, 'A', 'Z') ||
+           CharUtils.inRange(codepoint, 'a', 'z');
+  }
+
+  public static boolean isAlphaNum(int codepoint) {
+    return isDigit(codepoint) || isAlpha(codepoint);
+  }
+
+  public static boolean isPctEnc(int codepoint) {
+    return codepoint == '%' ||
+           isDigit(codepoint) ||
+           CharUtils.inRange(codepoint,'A','F') ||
+           CharUtils.inRange(codepoint,'a','f');
+  }
+  
+  public static boolean isMark(int codepoint) {
+    return codepoint == '-'  ||
+           codepoint == '_'  ||
+           codepoint == '.'  ||
+           codepoint == '!'  ||
+           codepoint == '~'  ||
+           codepoint == '*'  ||
+           codepoint == '\\' ||
+           codepoint == '\'' ||
+           codepoint == '('  ||
+           codepoint == ')';
+  }
+  
+  public static boolean isUnreserved(int codepoint) {
+    return isAlphaNum(codepoint) || isMark(codepoint);
+  }
+
+  public static boolean isReserved(int codepoint) {
+    return codepoint == '$' ||
+           codepoint == '&' ||
+           codepoint == '+' ||
+           codepoint == ',' ||
+           codepoint == '/' ||
+           codepoint == ':' ||
+           codepoint == ';' ||
+           codepoint == '=' ||
+           codepoint == '?' ||
+           codepoint == '@' ||
+           codepoint == '[' ||
+           codepoint == ']';
+  }
+  
+  public static boolean isGenDelim(int codepoint) {
+    return codepoint == '#' ||
+           codepoint == '/' ||
+           codepoint == ':' ||
+           codepoint == '?' ||
+           codepoint == '@' ||
+           codepoint == '[' ||
+           codepoint == ']';
+  }
+  
+  public static boolean isSubDelim(int codepoint) {
+    return codepoint == '!' || 
+           codepoint == '$' || 
+           codepoint == '&' || 
+           codepoint == '\'' || 
+           codepoint == '(' || 
+           codepoint == ')' || 
+           codepoint == '*' || 
+           codepoint == '+' || 
+           codepoint == ',' || 
+           codepoint == ';' || 
+           codepoint == '=' || 
+           codepoint == '\\';
+  }
+  
+  public static boolean isPchar(int codepoint) {
+    return isUnreserved(codepoint) ||  
+           codepoint == ':' || 
+           codepoint == '@' || 
+           codepoint == '&' || 
+           codepoint == '=' || 
+           codepoint == '+' || 
+           codepoint == '$' || 
+           codepoint == ',';
+  }
+
+  public static boolean isPath(int codepoint) {
+    return isPchar(codepoint) || 
+           codepoint == ';' ||
+           codepoint == '/' ||
+           codepoint == '%' || 
+           codepoint == ',';
+  }
+  
+  public static boolean isPathNoDelims(int codepoint) {
+    return isPath(codepoint) && !isGenDelim(codepoint);
+  }
+
+  public static boolean isScheme(int codepoint) {
+    return isAlphaNum(codepoint) || 
+           codepoint == '+' || 
+           codepoint == '-' ||
+           codepoint == '.';
+  }
+  
+
+  public static boolean isUserInfo(int codepoint) {
+    return isUnreserved(codepoint) || 
+           isSubDelim(codepoint) ||
+           isPctEnc(codepoint);
+  }
+  
+  public static boolean isQuery(int codepoint) {
+    return isPchar(codepoint) ||
+           codepoint == ';' || 
+           codepoint == '/' ||
+           codepoint == '?' ||
+           codepoint == '%';
+  }
+
+  public static boolean isFragment(int codepoint) {
+    return isPchar(codepoint) ||
+           codepoint == '/' ||
+           codepoint == '?' ||
+           codepoint == '%';
+  }
+  
+  public static boolean isBidi(int codepoint) {
+    return  codepoint == '\u200E' || // Left-to-right mark
+            codepoint == '\u200F' || // Right-to-left mark
+            codepoint == '\u202A' || // Left-to-right embedding
+            codepoint == '\u202B' || // Right-to-left embedding
+            codepoint == '\u202D' || // Left-to-right override
+            codepoint == '\u202E' || // Right-to-left override
+            codepoint == '\u202C';   // Pop directional formatting
+  }
+  
+  public static boolean is_ucschar(int codepoint) {    
+    return 
+        CharUtils.inRange(codepoint,'\u00A0', '\uD7FF') ||
+        CharUtils.inRange(codepoint,'\uF900','\uFDCF') ||
+        CharUtils.inRange(codepoint,'\uFDF0','\uFFEF') ||
+        CharUtils.inRange(codepoint,0x10000,0x1FFFD) ||
+        CharUtils.inRange(codepoint,0x20000,0x2FFFD) ||
+        CharUtils.inRange(codepoint,0x30000,0x3FFFD) ||
+        CharUtils.inRange(codepoint,0x40000,0x4FFFD) ||
+        CharUtils.inRange(codepoint,0x50000,0x5FFFD) ||
+        CharUtils.inRange(codepoint,0x60000,0x6FFFD) ||
+        CharUtils.inRange(codepoint,0x70000,0x7FFFD) ||
+        CharUtils.inRange(codepoint,0x80000,0x8FFFD) ||
+        CharUtils.inRange(codepoint,0x90000,0x9FFFD) ||
+        CharUtils.inRange(codepoint,0xA0000,0xAFFFD) ||
+        CharUtils.inRange(codepoint,0xB0000,0xBFFFD) ||
+        CharUtils.inRange(codepoint,0xC0000,0xCFFFD) ||
+        CharUtils.inRange(codepoint,0xD0000,0xDFFFD) ||
+        CharUtils.inRange(codepoint,0xE1000,0xEFFFD);
+  }
+
+  public static boolean is_iprivate(int codepoint) {
+    return
+      CharUtils.inRange(codepoint,'\uE000', '\uF8FF') ||
+      CharUtils.inRange(codepoint, 0xF0000,0xFFFFD) ||
+      CharUtils.inRange(codepoint, 0x100000,0x10FFFD);
+  }
+  
+  public static boolean is_iunreserved(int codepoint) {
+    return isAlphaNum(codepoint) || isMark(codepoint) || is_ucschar(codepoint);
+  }
+
+  public static boolean is_ipchar(int codepoint) {
+    return is_iunreserved(codepoint) || 
+           codepoint == ':' || 
+           codepoint == '@' || 
+           codepoint == '&' || 
+           codepoint == '=' || 
+           codepoint == '+' || 
+           codepoint == '$';
+  }
+
+  public static boolean is_ipath(int codepoint) {
+    return is_ipchar(codepoint) || 
+           codepoint == ';' ||
+           codepoint == '/' ||
+           codepoint == '%' || 
+           codepoint == ',';
+  }
+  
+  public static boolean is_ipathnodelims(int codepoint) {
+    return is_ipath(codepoint) && !isGenDelim(codepoint);
+  }
+
+  public static boolean is_iquery(int codepoint) {
+    return is_ipchar(codepoint) || 
+           is_iprivate(codepoint) || 
+           codepoint == ';' ||
+           codepoint == '/' ||
+           codepoint == '?' ||
+           codepoint == '%';
+  }
+
+  public static boolean is_ifragment(int codepoint) {
+    return is_ipchar(codepoint) || 
+           is_iprivate(codepoint) || 
+           codepoint == '/' ||
+           codepoint == '?' ||
+           codepoint == '%';
+  }  
+  
+  public static boolean is_iregname(int codepoint) {
+    return is_iunreserved(codepoint) || 
+           codepoint == '!'  || 
+           codepoint == '$'  || 
+           codepoint == '&'  || 
+           codepoint == '\'' || 
+           codepoint == '('  || 
+           codepoint == ')'  || 
+           codepoint == '*'  || 
+           codepoint == '+'  || 
+           codepoint == ','  || 
+           codepoint == ';'  || 
+           codepoint == '='  || 
+           codepoint == '"';
+  }
+  
+  public static boolean is_regname(int codepoint) {
+    return isUnreserved(codepoint) || 
+           codepoint == '!'  || 
+           codepoint == '$'  || 
+           codepoint == '&'  || 
+           codepoint == '\'' || 
+           codepoint == '('  || 
+           codepoint == ')'  || 
+           codepoint == '*'  || 
+           codepoint == '+'  || 
+           codepoint == ','  || 
+           codepoint == ';'  || 
+           codepoint == '='  || 
+           codepoint == '"';
+  }
+  
+  public static boolean is_iuserinfo(int codepoint) {
+    return is_iunreserved(codepoint) || 
+           codepoint == ';' || 
+           codepoint == ':' || 
+           codepoint == '&' || 
+           codepoint == '=' || 
+           codepoint == '+' || 
+           codepoint == '$' || 
+           codepoint == ',';
+  }
+  
+  public static boolean is_iserver(int codepoint) {
+    return is_iuserinfo(codepoint) || 
+           is_iregname(codepoint) || 
+           isAlphaNum(codepoint) || 
+           codepoint == '.' || 
+           codepoint == ':' || 
+           codepoint == '@' || 
+           codepoint == '[' || 
+           codepoint == ']' || 
+           codepoint == '%' || 
+           codepoint == '-';
+  }
+
 }
+

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java Mon Nov  5 12:15:09 2007
@@ -31,7 +31,7 @@
 
   @Override
   public String getMessage() {
-    return "Invalid Character 0x" + Integer.toHexString(input);
+    return "Invalid Character 0x" + Integer.toHexString(input) + "(" + (char)input + ")";
   }
 
   

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java Mon Nov  5 12:15:09 2007
@@ -17,14 +17,8 @@
 */
 package org.apache.abdera.i18n.io;
 
-import java.util.BitSet;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 
-import org.apache.abdera.i18n.ChainableBitSet;
-import org.apache.abdera.i18n.io.CharUtils;
-import org.apache.abdera.i18n.io.CodepointIterator;
-import org.apache.abdera.i18n.io.FilterCodepointIterator;
-import org.apache.abdera.i18n.io.InvalidCharacterException;
-import org.apache.abdera.i18n.io.RestrictedCodepointIterator;
 
 
 /**
@@ -36,33 +30,33 @@
 public class RestrictedCodepointIterator 
   extends FilterCodepointIterator {
 
-  private BitSet bitset;
+  private final Profile profile;
   private boolean scanningOnly = false;
   private boolean notset = false;
 
   protected RestrictedCodepointIterator(
     CodepointIterator internal, 
-    BitSet bitset) {
-      this(internal,bitset,false);
+    Profile profile) {
+      this(internal,profile,false);
   }
 
   protected RestrictedCodepointIterator(
     CodepointIterator internal, 
-    BitSet bitset,
+    Profile profile,
     boolean scanningOnly) {
-      this(internal, bitset, scanningOnly, false);
+      this(internal, profile, scanningOnly, false);
   }
   
   protected RestrictedCodepointIterator(
-      CodepointIterator internal, 
-      BitSet bitset,
-      boolean scanningOnly,
-      boolean notset) {
+    CodepointIterator internal, 
+    Profile profile,
+    boolean scanningOnly,
+    boolean notset) {
       super(internal);
-      this.bitset = bitset;
+      this.profile = profile;
       this.scanningOnly = scanningOnly;
       this.notset = notset;
-    }
+  }
 
   public boolean hasNext() {
     boolean b = super.hasNext();
@@ -89,7 +83,8 @@
   }
 
   private boolean check(int cp) {
-    return (!notset) ? !bitset.get(cp) : bitset.get(cp);
+    boolean answer = !profile.check(cp);
+    return (!notset) ? !answer : answer;
   }
   
   @Override
@@ -116,13 +111,4 @@
     return chars;
   }
  
-  public static void main(String... args) throws Exception {
-    
-    ChainableBitSet set = new ChainableBitSet().set2('a','b','c');
-    char[] c = {'a','b','c',CharUtils.getHighSurrogate(0x10000),CharUtils.getLowSurrogate(0x10000)};
-    
-    CodepointIterator ci = CodepointIterator.forCharArray(c);
-    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false,true);
-    while(rci.hasNext()) System.out.println(rci.next());
-  }
 }

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/AbstractScheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/AbstractScheme.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/AbstractScheme.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/AbstractScheme.java Mon Nov  5 12:15:09 2007
@@ -17,8 +17,6 @@
 */
 package org.apache.abdera.i18n.iri;
 
-import org.apache.abdera.i18n.iri.IRI;
-import org.apache.abdera.i18n.iri.Scheme;
 
 /**
  * Base implementation for IRI scheme providers
@@ -27,24 +25,21 @@
   implements Scheme {
 
   protected final String name;
+  protected final int port;
   
-  protected AbstractScheme(String name) {
+  protected AbstractScheme(String name, int port) {
     this.name = name;
+    this.port = port;
+  }
+  
+  public int getDefaultPort() {
+    return port;
   }
   
   public String getName() {
     return name;
   }
 
-  /**
-   * Default to use normalization-based comparison
-   */
-  public boolean equivalent(IRI iri1, IRI iri2) {
-    String s2 = iri2.normalize().toASCIIString();
-    String s1 = iri1.normalize().toASCIIString();
-    return s1.compareTo(s2) == 0;
-  }
-  
   /**
    * Default return unmodified
    */

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/DefaultScheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/DefaultScheme.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/DefaultScheme.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/DefaultScheme.java Mon Nov  5 12:15:09 2007
@@ -17,12 +17,14 @@
 */
 package org.apache.abdera.i18n.iri;
 
-import org.apache.abdera.i18n.iri.AbstractScheme;
-
 public class DefaultScheme extends AbstractScheme {
 
   public DefaultScheme(String name) {
-    super(name);
+    super(name,-1);
+  }
+  
+  public DefaultScheme(String name, int port) {
+    super(name,port);
   }
 
 }

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Escaping.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Escaping.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Escaping.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Escaping.java Mon Nov  5 12:15:09 2007
@@ -20,9 +20,9 @@
 import java.io.ByteArrayInputStream;
 import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
-import java.util.BitSet;
 
 import org.apache.abdera.i18n.io.CharUtils;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 
 
 /**
@@ -46,32 +46,43 @@
   }
   
   public static String encode(String s) {
-    return encode(s,(BitSet)null);
+    return encode(s,Profile.NONE);
   }
   
-  public static String encode(String s, BitSet... maps) {
+  public static String encode(String s, Profile profile) {
+    return encode(s, new Profile[] {profile});
+  }
+  
+  public static String encode(String s, Profile... profiles) {
     try {
       if (s == null) return null;
-      return encode(s,"utf-8",maps);
+      return encode(s,"utf-8",profiles);
     } catch (UnsupportedEncodingException e) {
       return null; // shouldn't happen
     }
   }
   
+  private static boolean check(int codepoint, Profile... profiles) {
+    for (Profile profile : profiles) {
+      if (profile.check(codepoint)) return true;
+    }
+    return false;
+  }
+  
   public static String encode(
     String s, 
     String enc, 
-    BitSet... maps) 
+    Profile... profiles) 
       throws UnsupportedEncodingException {
     if (s == null) return s;
     StringBuffer sb = new StringBuffer();
     char[] chars = s.toCharArray();
     for (int n = 0; n < chars.length; n++) {
       char c = (char) chars[n];
-      if (!CharUtils.isSet(c,maps) && !CharUtils.isHighSurrogate(c)) {
+      if (!CharUtils.isHighSurrogate(c) && check(c,profiles)) {
         encode(sb,String.valueOf(c).getBytes(enc));
       } else if (CharUtils.isHighSurrogate(c)) {
-        if (!CharUtils.isSet(c,maps)) {
+        if (check(c,profiles)) {
           StringBuffer buf = new StringBuffer();
           buf.append(c);
           buf.append(chars[++n]);

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/FtpScheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/FtpScheme.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/FtpScheme.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/FtpScheme.java Mon Nov  5 12:15:09 2007
@@ -25,10 +25,7 @@
   static final int DEFAULT_PORT = 21;
   
   public FtpScheme() {
-    super(NAME);
+    super(NAME,DEFAULT_PORT);
   }
   
-  protected int getDefaultPort() {
-    return FtpScheme.DEFAULT_PORT;
-  }
 }

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpScheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpScheme.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpScheme.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpScheme.java Mon Nov  5 12:15:09 2007
@@ -17,9 +17,8 @@
 */
 package org.apache.abdera.i18n.iri;
 
-import org.apache.abdera.i18n.iri.AbstractScheme;
-import org.apache.abdera.i18n.iri.HttpScheme;
-import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
+
 
 class HttpScheme extends AbstractScheme {
 
@@ -27,41 +26,11 @@
   static final int DEFAULT_PORT = 80;
   
   public HttpScheme() {
-    super(NAME);
-  }
-  
-  protected HttpScheme(String name) {
-    super(name);
-  }
-
-  protected int getDefaultPort() {
-    return HttpScheme.DEFAULT_PORT;
-  }
-
-  private boolean equal(String s1, String s2) {
-    return ((s1 != null && s1.equals(s2)) ||
-           ((s2 != null && s2.equals(s1)) ||
-             s1 == null && s2 == null));
+    super(NAME,DEFAULT_PORT);
   }
   
-  @Override
-  public boolean equivalent(IRI iri1, IRI iri2) {
-    if (super.equivalent(iri1, iri2)) 
-      return true;
-    if (!iri1.getScheme().equals(iri2.getScheme()))
-      return false;
-    iri1 = iri1.normalize();
-    iri2 = iri2.normalize();
-    int port1 = (iri1.getPort() != -1) ? iri1.getPort() : getDefaultPort();
-    int port2 = (iri2.getPort() != -1) ? iri2.getPort() : getDefaultPort();
-    return
-        equal(iri1.getUserInfo(),iri2.getUserInfo()) &&
-        equal(iri1.getASCIIHost(),iri2.getASCIIHost()) &&
-        port1 == port2 &&
-        equal(iri1.getASCIIPath(),iri2.getASCIIPath()) &&
-        equal(iri1.getQuery(),iri2.getQuery()) &&
-        equal(iri1.getFragment(),iri2.getFragment());
-    
+  protected HttpScheme(String name, int port) {
+    super(name,port);
   }
 
   @Override
@@ -84,9 +53,9 @@
         ui,
         host,
         port,
-        IRI.normalize(this,iri.getPath()),
-        iri.getQuery(),
-        iri.getFragment()
+        IRI.normalize(iri.getPath()),
+        Escaping.encode(Escaping.decode(iri.getQuery()),Profile.IQUERY),
+        Escaping.encode(Escaping.decode(iri.getFragment()),Profile.IFRAGMENT)
       );
   }
   

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpsScheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpsScheme.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpsScheme.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpsScheme.java Mon Nov  5 12:15:09 2007
@@ -17,8 +17,6 @@
 */
 package org.apache.abdera.i18n.iri;
 
-import org.apache.abdera.i18n.iri.HttpScheme;
-import org.apache.abdera.i18n.iri.HttpsScheme;
 
 class HttpsScheme 
   extends HttpScheme {
@@ -27,10 +25,7 @@
   static final int DEFAULT_PORT = 443;
   
   public HttpsScheme() {
-    super(NAME);
+    super(NAME, DEFAULT_PORT);
   }
   
-  protected int getDefaultPort() {
-    return HttpsScheme.DEFAULT_PORT;
-  }
 }

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IDNA.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IDNA.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IDNA.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IDNA.java Mon Nov  5 12:15:09 2007
@@ -22,10 +22,7 @@
 import java.net.UnknownHostException;
 
 import org.apache.abdera.i18n.io.CharUtils;
-import org.apache.abdera.i18n.iri.Constants;
-import org.apache.abdera.i18n.iri.IDNA;
-import org.apache.abdera.i18n.iri.Nameprep;
-import org.apache.abdera.i18n.iri.Punycode;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 
 
 /**
@@ -37,7 +34,7 @@
 
   private static final long serialVersionUID = -617056657751424334L;
   private final String regname;
-  
+    
   public IDNA(java.net.InetAddress addr) {
     this(addr.getHostName());
   }
@@ -102,10 +99,10 @@
       if (regname.length() == 0) return regname;
       String[] labels = regname.split("\\\u002E");
       StringBuffer buf = new StringBuffer();
-      for (String label : labels) {
+      for (String label : labels) {        
         label = Nameprep.prep(label);
         char[] chars = label.toCharArray();
-        CharUtils.verifyNot(chars, Constants.STD3ASCIIRULES);
+        CharUtils.verifyNot(chars, Profile.STD3ASCIIRULES);
         if (chars[0] == '\u002D' || 
             chars[chars.length-1] == '\u002D')
               throw new IOException("ToASCII violation");

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java Mon Nov  5 12:15:09 2007
@@ -19,7 +19,6 @@
 
 import java.io.IOException;
 import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.util.regex.Matcher;
@@ -27,19 +26,21 @@
 
 import org.apache.abdera.i18n.io.CharUtils;
 import org.apache.abdera.i18n.io.InvalidCharacterException;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 import org.apache.abdera.i18n.unicode.Normalizer;
+import org.apache.abdera.i18n.unicode.UnicodeCharacterDatabase;
 
-public class IRI 
+public final class IRI 
   implements Serializable, 
              Cloneable {
   
   private static final long serialVersionUID = -4530530782760282284L;
-  Scheme _scheme;
+  protected Scheme _scheme;
   private String scheme;
   private String authority;
   private String userinfo;
   private String host;
-  private int port;
+  private int port = -1;
   private String path;
   private String query;
   private String fragment;
@@ -51,51 +52,17 @@
   private String a_userinfo;
   private String a_authority;
   
-  private String d_authority;
-  private String d_userinfo;
-  private String d_host;
-  private String d_path;
-  private String d_query;
-  private String d_fragment;
-  
   public IRI(java.net.URL url) {
-    this(Escaping.encode(
-        Escaping.decode(url.toString()), 
-        Constants.IUNRESERVED, 
-        Constants.RESERVED, 
-        Constants.PCTENC));
+    this(url.toString());
   }
   
   public IRI(java.net.URI uri) {
-    this(Escaping.encode(
-      Escaping.decode(uri.toString()), 
-      Constants.IUNRESERVED, 
-      Constants.RESERVED, 
-      Constants.PCTENC,
-      Constants.GENDELIMS));
-  }
-  
-  public IRI(java.net.URI uri, String enc) throws UnsupportedEncodingException {
-    this(Escaping.encode(
-        Escaping.decode(uri.toString(),enc), enc,
-        Constants.IUNRESERVED, 
-        Constants.RESERVED, 
-        Constants.PCTENC,
-        Constants.GENDELIMS));
+    this(uri.toString());
   }
   
   public IRI(String iri) {
-    Builder b = parse(CharUtils.stripBidi(iri));
-    init(
-      b.schemeobj,
-      b.scheme,
-      b.authority,
-      b.userinfo,
-      b.host,
-      b.port,
-      b.path,
-      b.query,
-      b.fragment);
+    parse(CharUtils.stripBidi(iri));
+    init();
   }
   
   public IRI(String iri, Normalizer.Form nf) throws IOException {
@@ -110,13 +77,18 @@
     String path, 
     String query, 
     String fragment) {
-      SchemeRegistry reg = SchemeRegistry.getInstance();
-      Scheme _scheme = reg.getScheme(scheme);
+      this.scheme = scheme;
+      this._scheme = SchemeRegistry.getInstance().getScheme(scheme);
+      this.userinfo = userinfo;
+      this.host = host;
+      this.port = port;
+      this.path = path;
+      this.query = query;
+      this.fragment = fragment;
       StringBuffer buf = new StringBuffer();
       buildAuthority(buf,userinfo, host, port);
-      String authority = (buf.length()!=0)?buf.toString():null;
-      init(_scheme,scheme,authority,userinfo,
-        host,port,path,query,fragment);
+      this.authority = (buf.length()!=0)?buf.toString():null;
+      init();
   }
   
   public IRI(
@@ -125,14 +97,14 @@
     String path,
     String query,
     String fragment) {
-    Builder builder = new Builder();
-    builder.authority = authority;
-    Parser.parseAuthority(builder);
-    SchemeRegistry reg = SchemeRegistry.getInstance();
-    Scheme _scheme = reg.getScheme(scheme);
-    init(_scheme,scheme,authority,builder.userinfo,
-      builder.host,builder.port,path,query,
-      fragment);
+      this.scheme = scheme;
+      this._scheme = SchemeRegistry.getInstance().getScheme(scheme);
+      this.authority = authority;
+      this.path = path;
+      this.query = query;
+      this.fragment = fragment;
+      parseAuthority();
+      init();
   }
   
   public IRI(
@@ -153,42 +125,24 @@
     String path,
     String query,
     String fragment) {
-      init(_scheme,scheme,authority,userinfo,
-         host,port,path,query,fragment);
-  }
-  
-  private void init(
-      Scheme _scheme,
-      String scheme,
-      String authority,
-      String userinfo,
-      String host,
-      int port,
-      String path,
-      String query,
-      String fragment) {
-    this._scheme = _scheme;
-    this.scheme = scheme;
-    this.authority = authority;
-    this.userinfo = userinfo;
-    this.host = host; 
-    this.port = port;
-    this.path = (path != null) ? path : "";
-    this.query = query;
-    this.fragment = fragment;
-
-    d_authority = Escaping.decode(this.authority);
-    d_userinfo = Escaping.decode(userinfo);
-    d_path = Escaping.decode(path);
-    d_query = query; //Escaping.decode(query);
-    d_fragment = Escaping.decode(fragment);
-    d_host = IDNA.toUnicode(Escaping.decode(this.host));
-
-    a_host = IDNA.toASCII(d_host);
-    a_fragment = Escaping.encode(getFragment(),Constants.FRAGMENT);
-    a_path = Escaping.encode(getPath(), Constants.PATH);
-    a_query = Escaping.encode(getQuery(),Constants.QUERY, Constants.PATH);
-    a_userinfo = Escaping.encode(getUserInfo(),Constants.USERINFO,Constants.COLON);
+      this._scheme = _scheme;
+      this.scheme = scheme;
+      this.authority = authority;
+      this.userinfo = userinfo;
+      this.host = host;
+      this.port = port;
+      this.path = path;
+      this.query = query;
+      this.fragment = fragment;
+      init();
+  }
+  
+  private void init() {    
+    a_host = IDNA.toASCII(host);
+    a_fragment = Escaping.encode(fragment,Profile.FRAGMENT);
+    a_path = Escaping.encode(path, Profile.PATH);
+    a_query = Escaping.encode(query,Profile.QUERY, Profile.PATH);
+    a_userinfo = Escaping.encode(userinfo,Profile.USERINFO);
     a_authority = buildASCIIAuthority();
   }
     
@@ -255,30 +209,21 @@
       return false;
     return true;
   }
-
-  public boolean equivalent(IRI uri) {
-    if (_scheme != null) return _scheme.equivalent(this, uri);
-    else {
-      String s2 = uri.normalize().toASCIIString();
-      String s1 = this.normalize().toASCIIString();
-      return s1.compareTo(s2) == 0;
-    }
-  }
   
   public String getAuthority() {
-    return (d_authority != null && d_authority.length() > 0) ? d_authority : null;
+    return (authority != null && authority.length() > 0) ? authority : null;
   }
   
   public String getFragment() {
-    return d_fragment;
+    return fragment;
   }
   
   public String getHost() {
-    return (d_host != null && d_host.length() > 0) ? d_host : null;
+    return (host != null && host.length() > 0) ? host : null;
   }
   
   public IDNA getIDN() {
-    return new IDNA(d_host);
+    return new IDNA(host);
   }
   
   public String getASCIIHost() {
@@ -286,7 +231,7 @@
   }
   
   public String getPath() {
-    return d_path;
+    return path;
   }
   
   public int getPort() {
@@ -294,7 +239,7 @@
   }
   
   public String getQuery() {
-    return d_query;
+    return query;
   }
   
   public String getScheme() {
@@ -310,38 +255,6 @@
   }
   
   public String getUserInfo() {
-    return d_userinfo;
-  }
-  
-  public String getRawHost() {
-    return (host != null && host.length() > 0) ? host : null;
-  }
-  
-  public String getRawAuthority() {
-    return (authority != null && authority.length() > 0) ? authority : null;
-  }
-  
-  public String getRawFragment() {
-    return fragment;
-  }
-  
-  public String getRawPath() {
-    return path;
-  }
-  
-  public String getRawQuery() {
-    return query;
-  }
-  
-  public String getRawSchemeSpecificPart() {
-    return buildSchemeSpecificPart(
-      authority,
-      path, 
-      query, 
-      fragment);
-  }
-  
-  public String getRawUserInfo() {
     return userinfo;
   }
   
@@ -374,9 +287,7 @@
     } else {
       return Escaping.encode(
         authority, 
-        Constants.USERINFO, 
-        Constants.REGNAME, 
-        Constants.GENDELIMS);
+        Profile.AUTHORITY);
     }
   }
   
@@ -432,8 +343,12 @@
       return buf.toString();
   }
   
-  public Object clone() throws CloneNotSupportedException {
-    return super.clone();
+  public Object clone() {
+    try {
+      return super.clone();
+    } catch (CloneNotSupportedException e) {
+      return new IRI(toString());  // not going to happen, but we have to catch it
+    }
   }
   
   public boolean isAbsolute() {
@@ -450,8 +365,8 @@
         (b.scheme != null && c.scheme == null) ||
         (b.scheme != null && c.scheme != null && 
           !b.scheme.equalsIgnoreCase(c.scheme))) return c;
-    String bpath = normalize(b._scheme,b.getPath());
-    String cpath = normalize(c._scheme,c.getPath());
+    String bpath = normalize(b.getPath());
+    String cpath = normalize(c.getPath());
     bpath = (bpath != null) ? bpath : "/";
     cpath = (cpath != null) ? cpath : "/";
     if (!bpath.equals(cpath)) {
@@ -461,7 +376,7 @@
     IRI iri = new IRI(
       null,
       null,null,null,null,-1,
-      normalize(b._scheme,cpath.substring(bpath.length())), 
+      normalize(cpath.substring(bpath.length())), 
       c.getQuery(), 
       c.getFragment());
     return iri;
@@ -489,7 +404,7 @@
     IRI b, 
     String c) 
       throws IOException {
-    return resolve(b, IRI.create(c));
+    return resolve(b, new IRI(c));
   }
   
   public static IRI resolve(IRI b, IRI c) {
@@ -499,11 +414,7 @@
       String bfragment = b.getFragment();
       if ((cfragment == null && bfragment == null) ||
           (cfragment != null && cfragment.equals(bfragment))) {
-          try {
-            return (IRI) b.clone();
-          } catch (Exception e) {
-            return null; // Not going to happen
-          } 
+          return (IRI) b.clone(); 
       } else {
         return new IRI(
           b._scheme,
@@ -512,7 +423,7 @@
           b.getUserInfo(),
           b.getHost(),
           b.getPort(),
-          normalize(b._scheme,b.getPath()),
+          normalize(b.getPath()),
           b.getQuery(),
           cfragment
         );
@@ -535,14 +446,14 @@
       host = b.getHost();
       port = b.getPort();
       path = c.isPathAbsolute() ? 
-          normalize(b._scheme,c.getPath()) : 
+          normalize(c.getPath()) : 
           resolve(b.getPath(),c.getPath());
     } else {
       authority = c.getAuthority();
       userinfo = c.getUserInfo();
       host = c.getHost();
       port = c.getPort();
-      path = normalize(b._scheme,c.getPath());
+      path = normalize(c.getPath());
     }
     return new IRI(
       _scheme,
@@ -573,17 +484,13 @@
         iri.getUserInfo(),
         iri.getHost(),
         iri.getPort(),
-        normalize(iri._scheme,iri.getPath()),
-        iri.getQuery(),
-        iri.getFragment()
+        normalize(iri.getPath()),
+        Escaping.encode(Escaping.decode(iri.getQuery()),Profile.IQUERY),
+        Escaping.encode(Escaping.decode(iri.getFragment()),Profile.IFRAGMENT)
       );
   }
 
-  static String normalize(Scheme scheme, String path) {
-    if (scheme != null) {
-      String n = scheme.normalizePath(path);
-      if (n != null) return n;
-    }
+  protected static String normalize(String path) {
     if (path == null || path.length() == 0) return "/";
     String[] segments = path.split("/");
     if (segments.length < 2) return path;
@@ -604,7 +511,11 @@
     for (int n = 0; n < segments.length; n++) {
       if (segments[n] != null) {
         if (buf.length() > 1) buf.append('/');
-        buf.append(segments[n]);
+        buf.append(
+          Escaping.encode(
+            Escaping.decode(
+              segments[n]),
+              Profile.IPATHNODELIMS));
       }
     }
     if (path.endsWith("/") || path.endsWith("/.")) 
@@ -622,7 +533,7 @@
     int n = bpath.lastIndexOf('/');
     if (n > -1) buf.append(bpath.substring(0,n+1));
     if (cpath.length() != 0) buf.append(cpath);
-    return normalize(new HttpScheme(),buf.toString());
+    return normalize(buf.toString());
   }
   
   public IRI resolve(IRI iri) {
@@ -630,7 +541,7 @@
   }
   
   public IRI resolve(String iri) {
-    return resolve(this,IRI.create(iri));
+    return resolve(this,new IRI(iri));
   }
   
   public String toString() {
@@ -641,7 +552,8 @@
       buf.append(':');
     }
     buf.append(getSchemeSpecificPart());
-    return Escaping.encode(buf.toString(),Constants.IUNRESERVED,Constants.RESERVED,Constants.IPRIVATE,Constants.PCTENC,Constants.HASH);
+    return Escaping.encode(buf.toString(),
+      Profile.SCHEMESPECIFICPART);
   }
   
   public String toASCIIString() {
@@ -670,93 +582,66 @@
     return toURI().toURL();
   }
   
-  ////////// parse implementation
-  
-  private static Builder parse(
-    String uri) {
-    try {
-      return Parser.parse(uri, SchemeRegistry.getInstance());
-    } catch (IOException e) {
-      throw new IRISyntaxException(e);
-    }
-  }
-  
-  public static IRI create(
-    String iri) {
-    return new IRI(iri);
-  }
   
-  public static IRI create(
-    String iri, 
-    Normalizer.Form nf) 
-      throws IOException {
-    return new IRI(iri,nf);
-  }
   
-  static class Builder {
-    private Scheme schemeobj;
-    private String scheme;
-    private String authority;
-    private String userinfo;
-    private String host;
-    private int port = -1;
-    private String path;
-    private String query;
-    private String fragment;
-  }
-  
-  static class Parser {
-    
-    static final Pattern p = 
-      Pattern.compile(
-        "^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?");
-    
-    static final Pattern a =
-      Pattern.compile("^(?:(.*)?@)?((?:\\[.*\\])|(?:[^:]*))?(?::(\\d*))?");
-    
-    static void parseAuthority(Builder builder) {
-      if (builder.authority != null) {
-        Matcher auth = a.matcher(builder.authority);
-        if (auth.find()) {
-          builder.userinfo = auth.group(1);
-          builder.host = auth.group(2);
-          if (auth.group(3) != null)
-            builder.port = Integer.parseInt(auth.group(3));
-        }
-        try {
-          CharUtils.verify(builder.userinfo, Constants.IUSERINFO);
-          CharUtils.verify(builder.host, Constants.IREGNAME);
-        } catch (InvalidCharacterException e) {
-          throw new IRISyntaxException(e);
-        }
+  private void parseAuthority() {
+    if (authority != null) {
+      Matcher auth = AUTHORITYPATTERN.matcher(authority);
+      if (auth.find()) {
+        userinfo = auth.group(1);
+        host = auth.group(2);
+        if (auth.group(3) != null)
+          port = Integer.parseInt(auth.group(3));
+        else port = -1;
+      }
+      try {
+        CharUtils.verify(userinfo, Profile.IUSERINFO);
+        CharUtils.verify(host, Profile.IREGNAME);
+      } catch (InvalidCharacterException e) {
+        throw new IRISyntaxException(e);
       }
     }
-    
-    static Builder parse(String iri, SchemeRegistry reg) 
-      throws IOException {
-      Matcher irim = p.matcher(iri);
-      Builder builder = new Builder();
+  }
+  
+  private void parse(String iri) {
+    try {
+      SchemeRegistry reg = SchemeRegistry.getInstance();
+      Matcher irim = IRIPATTERN.matcher(iri);
       if (irim.find()) {
-        builder.scheme = irim.group(1);
-        builder.schemeobj = reg.getScheme(builder.scheme);
-        builder.authority = irim.group(2);
-        builder.path = irim.group(3);
-        builder.query = irim.group(4);
-        builder.fragment = irim.group(5);
-        parseAuthority(builder);        
+        scheme = irim.group(1);
+        _scheme= reg.getScheme(scheme);
+        authority = irim.group(2);
+        path = irim.group(3);
+        query = irim.group(4);
+        fragment = irim.group(5);
+        parseAuthority();        
         try {
-          CharUtils.verify(builder.scheme, Constants.SCHEME);
-          CharUtils.verify(builder.path, Constants.IPATH);
-          CharUtils.verify(builder.query, Constants.IQUERY);
-          CharUtils.verify(builder.fragment, Constants.IFRAGMENT);
-        } catch (InvalidCharacterException e) {
+          CharUtils.verify(scheme, Profile.SCHEME);
+          CharUtils.verify(path, Profile.IPATH);
+          CharUtils.verify(query, Profile.IQUERY);
+          CharUtils.verify(fragment, Profile.IFRAGMENT);
+        } catch (InvalidCharacterException e) {     
           throw new IRISyntaxException(e);
         }
-        return builder;
       } else {
         throw new IRISyntaxException("Invalid Syntax");
       }
+    } catch (IRISyntaxException e) {
+      throw e;
+    } catch (Exception e) {
+      throw new IRISyntaxException(e);
     }
   }
   
+  private static final Pattern IRIPATTERN = 
+    Pattern.compile(
+      "^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?");
+  
+  private static final Pattern AUTHORITYPATTERN =
+    Pattern.compile("^(?:(.*)?@)?((?:\\[.*\\])|(?:[^:]*))?(?::(\\d*))?");
+  
+  public static void preinit() {
+    UnicodeCharacterDatabase.getCanonicalClass(1);
+    Nameprep.prep("");
+  }
 }

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Nameprep.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Nameprep.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Nameprep.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Nameprep.java Mon Nov  5 12:15:09 2007
@@ -25,8 +25,6 @@
 
 import org.apache.abdera.i18n.ChainableBitSet;
 import org.apache.abdera.i18n.io.CodepointIterator;
-import org.apache.abdera.i18n.iri.Nameprep;
-import org.apache.abdera.i18n.iri.NameprepCodepointIterator;
 import org.apache.abdera.i18n.unicode.Normalizer;
 
 
@@ -99,7 +97,7 @@
     }
     return map;
   }
-  
+    
   public static final BitSet UNASSIGNED = new ChainableBitSet()  
   .set2('\u0221')
   .set2('\u0234','\u024F')
@@ -921,4 +919,6 @@
     .set2(0x2F800,0x2FA1D)
     .set2(0xF0000,0xFFFFD)
     .set2(0x100000,0x10FFFD);
+  
+  public static final ChainableBitSet PROHIBITED_ALLOWUNASSIGNED = new ChainableBitSet().set2(PROHIBITED).addNot2(UNASSIGNED);
 }

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/NameprepCodepointIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/NameprepCodepointIterator.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/NameprepCodepointIterator.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/NameprepCodepointIterator.java Mon Nov  5 12:15:09 2007
@@ -21,7 +21,6 @@
 import org.apache.abdera.i18n.io.CodepointIterator;
 import org.apache.abdera.i18n.io.FilterCodepointIterator;
 import org.apache.abdera.i18n.io.InvalidCharacterException;
-import org.apache.abdera.i18n.iri.Nameprep;
 
 
 /**
@@ -61,8 +60,7 @@
     super(internal);
     PROHIBITED = (!allowunassigned) ? 
         Nameprep.PROHIBITED : 
-        ((ChainableBitSet)Nameprep.PROHIBITED.clone()).set2(
-            Nameprep.UNASSIGNED,false);
+        Nameprep.PROHIBITED_ALLOWUNASSIGNED;
   }
 
   @Override

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Scheme.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Scheme.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Scheme.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Scheme.java Mon Nov  5 12:15:09 2007
@@ -17,7 +17,6 @@
 */
 package org.apache.abdera.i18n.iri;
 
-import org.apache.abdera.i18n.iri.IRI;
 
 /**
  * Interface implemented by custom IRI scheme parsers
@@ -26,10 +25,9 @@
 
   String getName();
   
-  boolean equivalent(IRI iri1, IRI iri2);
-  
   IRI normalize(IRI iri); 
   
   String normalizePath(String path);
-  
+ 
+  int getDefaultPort();
 }

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java Mon Nov  5 12:15:09 2007
@@ -23,9 +23,7 @@
 
 import org.apache.abdera.i18n.io.CharUtils;
 import org.apache.abdera.i18n.io.InvalidCharacterException;
-import org.apache.abdera.i18n.iri.Constants;
-import org.apache.abdera.i18n.lang.InvalidLangTagSyntax;
-import org.apache.abdera.i18n.lang.Lang;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 
 
 /**
@@ -162,13 +160,13 @@
     if (tags.length == 0) throw new InvalidLangTagSyntax();
     String primary = tags[0];
     try {
-      CharUtils.verify(primary,Constants.ALPHA);
+      CharUtils.verify(primary,Profile.ALPHA);
     } catch (InvalidCharacterException e) {
       throw new InvalidLangTagSyntax();
     }
     for (int n = 1; n < tags.length; n++) {
       try {
-        CharUtils.verify(tags[n],Constants.ALPHANUM);
+        CharUtils.verify(tags[n],Profile.ALPHANUM);
       } catch (InvalidCharacterException e) {
         throw new InvalidLangTagSyntax();
       }

Modified: incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIRI.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIRI.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIRI.java (original)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIRI.java Mon Nov  5 12:15:09 2007
@@ -19,12 +19,11 @@
 
 import java.net.URI;
 
+import junit.framework.TestCase;
+
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.i18n.unicode.Normalizer;
 
-
-import junit.framework.TestCase;
-
 public class TestIRI extends TestCase {
 
   public static void testSimple() throws Exception {
@@ -49,24 +48,6 @@
     assertEquals(iri.toURI().toString(),"http://example.com/%F0%90%8C%80%F0%90%8C%81%F0%90%8C%82");
   }
     
-  public static void testURItoIRI() throws Exception {
-    URI uri = new URI("http://www.example.org/D%C3%BCrst");
-    IRI iri = new IRI(uri);
-    assertEquals(iri.toString(),"http://www.example.org/D\u00FCrst");
-  }
-  
-  public static void testURItoIRI2() throws Exception {
-    URI uri = new URI("http://www.example.org/D%FCrst");
-    IRI iri = new IRI(uri, "windows-1252");
-    assertEquals(iri.toString(),"http://www.example.org/D\u00FCrst");
-  }
-
-  public static void testURItoIRI3() throws Exception {
-    URI uri = new URI("http://xn--99zt52a.example.org/%e2%80%ae");
-    IRI iri = new IRI(uri);
-    assertEquals(iri.toString(),"http://xn--99zt52a.example.org/%E2%80%AE");
-  }
-
   public static void testIRItoURI() throws Exception {
     IRI iri = new IRI("http://\u7D0D\u8C46.example.org/%E2%80%AE");
     URI uri = iri.toURI();
@@ -94,12 +75,6 @@
     assertTrue(iri3.normalize().equals(iri1.normalize()));
     assertTrue(iri3.normalize().equals(iri2.normalize()));
     
-    assertTrue(iri1.equivalent(iri2));
-    assertTrue(iri1.equivalent(iri3));
-    assertTrue(iri2.equivalent(iri1));
-    assertTrue(iri2.equivalent(iri3));
-    assertTrue(iri3.equivalent(iri1));
-    assertTrue(iri3.equivalent(iri2));
   }
   
   
@@ -110,17 +85,14 @@
   }
   
   public static void testPercent() throws Exception {
-      IRI iri1 = new IRI("http://example.org/~user");
-      IRI iri2 = new IRI("http://example.org/%7euser");
-      IRI iri3 = new IRI("http://example.org/%7Euser");
+      IRI iri1 = new IRI("http://example.org/%7e%2Fuser?%2f");
+      IRI iri2 = new IRI("http://example.org/%7E%2fuser?/");
       assertTrue(iri1.normalize().equals(iri2.normalize()));
-      assertTrue(iri1.normalize().equals(iri3.normalize()));
   }
   
   public static void testIDN() throws Exception {
     IRI iri1 = new IRI("http://r\u00E9sum\u00E9.example.org");
-    IRI iri2 = new IRI("http://xn--rsum-bpad.example.org");
-    assertTrue(iri1.equivalent(iri2));
+    assertEquals(iri1.getASCIIHost(),"xn--rsum-bpad.example.org");
   }
   
   public static void testRelative() throws Exception{

Modified: incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java (original)
+++ incubator/abdera/java/trunk/extensions/json/src/main/java/org/apache/abdera/ext/json/JSONUtil.java Mon Nov  5 12:15:09 2007
@@ -28,7 +28,7 @@
 import org.apache.abdera.ext.html.HtmlHelper;
 import org.apache.abdera.ext.thread.InReplyTo;
 import org.apache.abdera.ext.thread.ThreadHelper;
-import org.apache.abdera.i18n.iri.Constants;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 import org.apache.abdera.i18n.iri.Escaping;
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Base;
@@ -396,7 +396,7 @@
              "src".equalsIgnoreCase(name) || 
              "action".equalsIgnoreCase(name))) {
          IRI base = child.getResolvedBaseUri();
-         val = Escaping.encode(val.trim(),Constants.IUNRESERVED,Constants.RESERVED,Constants.IPRIVATE);
+         val = Escaping.encode(val.trim(),Profile.IUNRESERVED,Profile.RESERVED,Profile.IPRIVATE);
          if (base != null) val = base.resolve(val).toASCIIString();
         }
         jstream.writeQuoted(val);

Modified: incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java (original)
+++ incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java Mon Nov  5 12:15:09 2007
@@ -20,7 +20,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.abdera.i18n.iri.Constants;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 import org.apache.abdera.i18n.iri.Escaping;
 import org.apache.abdera.i18n.unicode.Normalizer;
 import org.apache.abdera.util.CompressionUtil;
@@ -89,7 +89,7 @@
       if (filler != null) {
         slug = slug.replaceAll(pattern,filler);
       } else { 
-        slug = Escaping.encode(slug, Constants.PATHNODELIMS);
+        slug = Escaping.encode(slug, Profile.PATHNODELIMS);
       }
       return slug;
   }

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java Mon Nov  5 12:15:09 2007
@@ -19,7 +19,6 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.BitSet;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -27,7 +26,7 @@
 
 import javax.activation.MimeType;
 
-import org.apache.abdera.i18n.iri.Constants;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 import org.apache.abdera.i18n.iri.Escaping;
 import org.apache.abdera.protocol.server.ResponseContext;
 import org.apache.abdera.protocol.util.AbstractResponse;
@@ -65,8 +64,8 @@
     setHeader(name, evals);
   }
   
-  public void setEscapedHeader(String name, BitSet mask, String value) {
-    setHeader(name,Escaping.encode(value, mask));
+  public void setEscapedHeader(String name, Profile profile, String value) {
+    setHeader(name,Escaping.encode(value, profile));
   }
   
   public void setHeader(String name, Object value) {
@@ -220,7 +219,7 @@
         slug.indexOf((char)13) > -1)
       throw new IllegalArgumentException(
         Messages.get("SLUG.BAD.CHARACTERS"));
-    setEscapedHeader("Slug", Constants.ASCIISANSCRLF, slug);
+    setEscapedHeader("Slug", Profile.ASCIISANSCRLF, slug);
   }
   
   public void setContentType(String type) {

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java?rev=592138&r1=592137&r2=592138&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractWorkspaceProvider.java Mon Nov  5 12:15:09 2007
@@ -23,7 +23,7 @@
 
 import org.apache.abdera.Abdera;
 import org.apache.abdera.factory.Factory;
-import org.apache.abdera.i18n.iri.Constants;
+import org.apache.abdera.i18n.io.CharUtils.Profile;
 import org.apache.abdera.i18n.iri.Escaping;
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.model.Collection;
@@ -77,8 +77,8 @@
           String id;
           String workspaceKey;
           try {
-            id = Escaping.encode(wp.getId(), enc, Constants.PATH);
-            workspaceKey = Escaping.encode(entry.getKey(), enc, Constants.PATH);
+            id = Escaping.encode(wp.getId(), enc, Profile.PATH);
+            workspaceKey = Escaping.encode(entry.getKey(), enc, Profile.PATH);
           } catch (UnsupportedEncodingException e) {
             throw new RuntimeException(e);
           }



Mime
View raw message