3import java.net.MalformedURLException;
5import java.net.URISyntaxException;
11 public static void showURX(
final String urx)
throws MalformedURLException, URISyntaxException {
12 System.err.println(
"WWWWWW "+urx);
15 System.err.println(
"WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW");
18 public static void showURL(
final URL url) {
19 System.err.println(
"XXXXXX URL "+url.toString());
20 System.err.println(
"protocol: "+url.getProtocol());
21 System.err.println(
"auth: "+url.getAuthority());
22 System.err.println(
"host: "+url.getHost());
23 System.err.println(
"port: "+url.getPort() +
" ( " + url.getDefaultPort() +
" ) " );
24 System.err.println(
"file: "+url.getFile() +
" ( path " + url.getPath() +
", query " + url.getQuery() +
" ) " );
25 System.err.println(
"ref: "+url.getRef());
28 public static void showURI(
final URI uri) {
29 showURI(
"YYYYYY URI "+uri+
", isOpaque "+uri.isOpaque()+
", isAbs "+uri.isAbsolute(), uri);
31 public static void showURI(
final String message,
final URI uri) {
32 System.err.println(message);
34 System.err.println(
"0.0.0 string: "+uri.toString());
35 System.err.println(
"0.0.0 ascii : "+uri.toASCIIString());
37 System.err.println(
"1.0.0 scheme: "+uri.getScheme());
38 System.err.println(
"2.0.0 scheme-part: "+uri.getRawSchemeSpecificPart()+
" (raw), "+uri.getSchemeSpecificPart()+
" (dec)");
39 System.err.println(
"2.1.0 auth: "+uri.getRawAuthority()+
" (raw), "+uri.getAuthority()+
" (dec)");
40 System.err.println(
"2.1.1 user-info: "+uri.getRawUserInfo()+
" (raw), "+uri.getUserInfo()+
" (dec)");
41 System.err.println(
"2.1.1 host: "+uri.getHost());
42 System.err.println(
"2.1.1 port: "+uri.getPort());
43 System.err.println(
"2.2.0 path: "+uri.getRawPath()+
" (raw), "+uri.getPath()+
" (dec)");
44 System.err.println(
"2.3.0 query: "+uri.getRawQuery()+
" (raw), "+uri.getQuery()+
" (dec)");
45 System.err.println(
"3.0.0 fragment: "+uri.getRawFragment()+
" (raw), "+uri.getFragment()+
" (dec)");
48 public static void showUri(
final Uri uri)
throws URISyntaxException {
49 showUri(
"ZZZZZZ Uri "+uri+
", isOpaque "+uri.opaque+
", isAbs "+uri.absolute+
", hasAuth "+uri.hasAuthority, uri);
52 public static void showUri(
final String message,
final Uri uri)
throws URISyntaxException {
53 System.err.println(message);
55 System.err.println(
"0.0.0 string: "+uri.toString());
56 System.err.println(
"0.0.0 ascii : "+uri.toASCIIString());
57 System.err.println(
"0.0.0 native-file: "+uri.toFile());
58 System.err.println(
"0.0.0 contained: "+uri.getContainedUri());
60 System.err.println(
"1.0.0 scheme: "+uri.scheme);
61 System.err.println(
"2.0.0 scheme-part: "+uri.schemeSpecificPart+
" (raw), "+
Uri.
decode(uri.schemeSpecificPart)+
" (dec)");
62 System.err.println(
"2.1.0 auth: "+uri.authority+
" (raw), "+
Uri.
decode(uri.authority)+
" (dec)");
63 System.err.println(
"2.1.1 user-info: "+uri.userInfo+
" (raw), "+
Uri.
decode(uri.userInfo)+
" (dec)");
64 System.err.println(
"2.1.1 host: "+uri.host);
65 System.err.println(
"2.1.1 port: "+uri.port);
66 System.err.println(
"2.2.0 path: "+uri.path+
" (raw), "+
Uri.
decode(uri.path)+
" (dec)");
67 System.err.println(
"2.3.0 query: "+uri.query+
" (raw), "+
Uri.
decode(uri.query)+
" (dec)");
68 System.err.println(
"3.0.0 fragment: "+uri.fragment+
" (raw), "+
Uri.
decode(uri.fragment)+
" (dec)");
78 final URI recomposedURI = uri.toURIReencoded();
79 showURI(
"YYYYYY Recomposed URI "+recomposedURI+
", isOpaque "+recomposedURI.isOpaque()+
", isAbs "+recomposedURI.isAbsolute(), recomposedURI);
80 final String recomposedURIStr = recomposedURI.toString();
81 final boolean equalsRecompURI = uri.input.toString().equals(recomposedURIStr);
82 System.err.println(
"source Uri: "+uri.input);
83 System.err.println(
"recomp URI: "+recomposedURIStr+
" - "+(equalsRecompURI?
"EQUAL":
"UNEQUAL"));
94 showUri(
"ZZZZZZ Recomposed Uri "+recomposedUri+
", isOpaque "+recomposedUri.
opaque+
", isAbs "+recomposedUri.
absolute+
", hasAuth "+recomposedUri.
hasAuthority, recomposedUri);
95 final String recomposedUriStr = recomposedUri.
toString();
96 final boolean equalsRecompUri = uri.toString().equals(recomposedUriStr);
97 System.err.println(
"source URI: "+uri.toString());
98 System.err.println(
"recomp Uri: "+recomposedUriStr+
" - "+(equalsRecompUri?
"EQUAL":
"UNEQUAL"));
static void showUri(final Uri uri)
static void showURX(final String urx)
static void showURI(final URI uri)
static void showUri(final String message, final Uri uri)
static void showReencodedUriOfURI(final URI uri)
Just showing different encoding of URI -> Uri.
static void showURI(final String message, final URI uri)
static void showURL(final URL url)
static void showReencodedURIOfUri(final Uri uri)
Just showing different encoding of Uri -> URI.
This class implements an immutable Uri as defined by RFC 2396.
final String toString()
Returns the encoded input as String, never null, same as getEncoded().
static String decode(final Encoded encoded)
Safe Encoded#decode() call on optional encoded instance.
final boolean hasAuthority
Indicating whether authority part is defined or not.
static Uri valueOf(final File file)
Creates a new Uri instance using the given File instance.
final boolean opaque
Indicating whether this Uri is opaque, i.e.
final boolean absolute
Indicating whether this Uri is absolute, i.e.