summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/net/UriQueryProps.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-09-10 07:21:03 +0200
committerSven Gothel <[email protected]>2014-09-10 07:21:03 +0200
commitc97e35377aea70cb293cabdd205bcc5da64b95c6 (patch)
tree52b4be4132fca18aff3067c199b9d6e9d54dfcac /src/java/com/jogamp/common/net/UriQueryProps.java
parent6a466e3f1e92a1e831ea61d1bb72c32f56b2a28d (diff)
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.
Diffstat (limited to 'src/java/com/jogamp/common/net/UriQueryProps.java')
-rw-r--r--src/java/com/jogamp/common/net/UriQueryProps.java8
1 files changed, 4 insertions, 4 deletions
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<String, String> 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 ) );
}
/**