git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@985154 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2010-08-13 10:53:48 +00:00
parent 72278d5e0f
commit e32c1ba9f8
2 changed files with 19 additions and 1 deletions

View File

@ -125,7 +125,7 @@ public class URISupport {
}
public static Map<String, String> parseParameters(URI uri) throws URISyntaxException {
if (uri.getQuery() != null) {
if (!isCompositeURI(uri)) {
return uri.getQuery() == null ? emptyMap() : parseQuery(stripPrefix(uri.getQuery(), "?"));
} else {
CompositeData data = URISupport.parseComposite(uri);
@ -188,12 +188,28 @@ public class URISupport {
CompositeData rc = new CompositeData();
rc.scheme = uri.getScheme();
String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim();
parseComposite(uri, rc, ssp);
rc.fragment = uri.getFragment();
return rc;
}
public static boolean isCompositeURI(URI uri) {
if (uri.getQuery() != null) {
return false;
} else {
String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "(").trim();
ssp = stripPrefix(ssp, "//").trim();
try {
new URI(ssp);
} catch (URISyntaxException e) {
return false;
}
return true;
}
}
/**
* @param uri

View File

@ -109,6 +109,8 @@ public class URISupportTest extends TestCase {
uri = new URI("static://http://localhost:61617?proxyHost=localhost&proxyPort=80");
parameters = URISupport.parseParameters(uri);
verifyParams(parameters);
uri = new URI("http://0.0.0.0:61616");
parameters = URISupport.parseParameters(uri);
}
private void verifyParams(Map<String,String> parameters) {