summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/net/URIDumpUtil.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-09-07 10:20:12 +0200
committerSven Gothel <[email protected]>2014-09-07 10:20:12 +0200
commit5205e47e8a2e84e793b26305391b1c4f8648597c (patch)
tree2487d359e99ce72f3dfe29f795da6d09f44fe54a /src/junit/com/jogamp/common/net/URIDumpUtil.java
parent0b07f9107c5b033913f5c4cbeb906ae6dafc2d77 (diff)
Bug 1063 - Utilize own Uri and Uri.Encoded class w/ proper encoding and differentiating encoded/decoded variants by type [Part 1]
- Add immutable com.jogamp.common.net.Uri class impl. RFC 2396 w/ encoding of RFC 3986 - Class Uri.Encoded is used to represent encoded parts - IOUtil: Remove unused methods (residing in Uri) and mark others deprecated (will move to Uri) - Adopt usage of Uri: This must be completet in follow-up commits!
Diffstat (limited to 'src/junit/com/jogamp/common/net/URIDumpUtil.java')
-rw-r--r--src/junit/com/jogamp/common/net/URIDumpUtil.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/junit/com/jogamp/common/net/URIDumpUtil.java b/src/junit/com/jogamp/common/net/URIDumpUtil.java
index 1a74742..a7d050a 100644
--- a/src/junit/com/jogamp/common/net/URIDumpUtil.java
+++ b/src/junit/com/jogamp/common/net/URIDumpUtil.java
@@ -42,4 +42,57 @@ public class URIDumpUtil {
System.err.println("2.3.0 query: "+uri.getRawQuery()+" (raw), "+uri.getQuery()+" (dec)");
System.err.println("3.0.0 fragment: "+uri.getRawFragment()+" (raw), "+uri.getFragment()+" (dec)");
}
+
+ public static void showUri(final Uri uri) throws URISyntaxException {
+ showUri("ZZZZZZ Uri "+uri+", isOpaque "+uri.opaque+", isAbs "+uri.absolute+", hasAuth "+uri.hasAuthority, uri);
+ }
+
+ public static void showUri(final String message, final Uri uri) throws URISyntaxException {
+ System.err.println(message);
+
+ System.err.println("0.0.0 string: "+uri.toString());
+ System.err.println("0.0.0 ascii : "+uri.toASCIIString());
+ System.err.println("0.0.0 native-file: "+uri.getNativeFilePath());
+ System.err.println("0.0.0 contained: "+uri.getContainedUri());
+
+ System.err.println("1.0.0 scheme: "+uri.scheme);
+ System.err.println("2.0.0 scheme-part: "+uri.schemeSpecificPart+" (raw), "+Uri.decode(uri.schemeSpecificPart)+" (dec)");
+ System.err.println("2.1.0 auth: "+uri.authority+" (raw), "+Uri.decode(uri.authority)+" (dec)");
+ System.err.println("2.1.1 user-info: "+uri.userInfo+" (raw), "+Uri.decode(uri.userInfo)+" (dec)");
+ System.err.println("2.1.1 host: "+uri.host);
+ System.err.println("2.1.1 port: "+uri.port);
+ System.err.println("2.2.0 path: "+uri.path+" (raw), "+Uri.decode(uri.path)+" (dec)");
+ System.err.println("2.3.0 query: "+uri.query+" (raw), "+Uri.decode(uri.query)+" (dec)");
+ System.err.println("3.0.0 fragment: "+uri.fragment+" (raw), "+Uri.decode(uri.fragment)+" (dec)");
+ }
+
+ /**
+ * Just showing different encoding of Uri -> URI
+ *
+ * @param uri
+ * @throws URISyntaxException
+ */
+ public static void showReencodedURIOfUri(final Uri uri) throws URISyntaxException {
+ final URI recomposedURI = uri.toURI(true);
+ showURI("YYYYYY Recomposed URI "+recomposedURI+", isOpaque "+recomposedURI.isOpaque()+", isAbs "+recomposedURI.isAbsolute(), recomposedURI);
+ final String recomposedURIStr = recomposedURI.toString();
+ final boolean equalsRecompURI = uri.input.equals(recomposedURIStr);
+ System.err.println("source Uri: "+uri.input);
+ System.err.println("recomp URI: "+recomposedURIStr+" - "+(equalsRecompURI?"EQUAL":"UNEQUAL"));
+ }
+
+ /**
+ * Just showing different encoding of URI -> Uri
+ *
+ * @param uri
+ * @throws URISyntaxException
+ */
+ public static void showReencodedUriOfURI(final URI uri) throws URISyntaxException {
+ final Uri recomposedUri = Uri.valueOf(uri, true);
+ showUri("ZZZZZZ Recomposed Uri "+recomposedUri+", isOpaque "+recomposedUri.opaque+", isAbs "+recomposedUri.absolute+", hasAuth "+recomposedUri.hasAuthority, recomposedUri);
+ final String recomposedUriStr = recomposedUri.toString();
+ final boolean equalsRecompUri = uri.toString().equals(recomposedUriStr);
+ System.err.println("source URI: "+uri.toString());
+ System.err.println("recomp Uri: "+recomposedUriStr+" - "+(equalsRecompUri?"EQUAL":"UNEQUAL"));
+ }
}