From c97e35377aea70cb293cabdd205bcc5da64b95c6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 10 Sep 2014 07:21:03 +0200 Subject: Bug 1063: Uri: Refine API doc; Add create(Encoded ..) ; Provide common impl. for getNormalized(), getDirectory(), getParent() and getRelativeOf() - Refine API doc - Add notion of {@code host} and {@code port} validation - Add create(Encoded ..), allowing creation of variants w/o re-encoding - Provide common impl. for getNormalized(), getDirectory(), getParent() and getRelativeOf() Above feature methods share common goals, hence use same implementation: - If opaque, cut-off query and merge after operation - cleanup path, i.e. /dummy/../test/ -> /test/ - cutoff file, dir - if requested - append optional appendix and cleanup again Return behavior various thought, i.e. null, this or allow exception. Enhanced test of above features. --- src/java/com/jogamp/common/net/UriQueryProps.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/java/com/jogamp/common/net/UriQueryProps.java') diff --git a/src/java/com/jogamp/common/net/UriQueryProps.java b/src/java/com/jogamp/common/net/UriQueryProps.java index 8d9bcb4..a93a1eb 100644 --- a/src/java/com/jogamp/common/net/UriQueryProps.java +++ b/src/java/com/jogamp/common/net/UriQueryProps.java @@ -63,14 +63,14 @@ public class UriQueryProps { public final Map getProperties() { return properties; } public final char getQuerySeparator() { return query_separator.charAt(0); } - public final String appendQuery(String baseQuery) { + public final Uri.Encoded appendQuery(Uri.Encoded baseQuery) { boolean needsSep = false; final StringBuilder sb = new StringBuilder(); if ( null != baseQuery ) { if( baseQuery.startsWith(QMARK) ) { baseQuery = baseQuery.substring(1); // cut off '?' } - sb.append(baseQuery); + sb.append(baseQuery.get()); if( !baseQuery.endsWith(query_separator) ) { needsSep = true; } @@ -87,11 +87,11 @@ public class UriQueryProps { } needsSep = true; } - return sb.toString(); + return new Uri.Encoded(sb.toString(), Uri.QUERY_LEGAL); } public final Uri appendQuery(final Uri base) throws URISyntaxException { - return base.getNewQuery( appendQuery( Uri.decode(base.query) ) ); + return base.getNewQuery( appendQuery( base.query ) ); } /** -- cgit v1.2.3