From 6cc5f40bf73eee73ae7f866d310b832f85d9e23f Mon Sep 17 00:00:00 2001 From: Claus Ibsen Date: Mon, 17 Sep 2012 12:04:47 +0000 Subject: [PATCH] AMQ-4058: http transport should not use uri parameters for remote url. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1386573 13f79535-47bb-0310-9956-ffa450edef68 --- .../transport/http/HttpTransportFactory.java | 12 +++++++++++- .../transport/https/HttpsTransportFactory.java | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java b/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java index 195322fcee..5ccb3f97c6 100755 --- a/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java +++ b/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java @@ -17,6 +17,7 @@ package org.apache.activemq.transport.http; import java.io.IOException; +import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; @@ -66,7 +67,16 @@ public class HttpTransportFactory extends TransportFactory { protected Transport createTransport(URI location, WireFormat wf) throws IOException { TextWireFormat textWireFormat = asTextWireFormat(wf); - return new HttpClientTransport(textWireFormat, location); + // need to remove options from uri + URI uri; + try { + uri = URISupport.removeQuery(location); + } catch (URISyntaxException e) { + MalformedURLException cause = new MalformedURLException("Error removing query on " + location); + cause.initCause(e); + throw cause; + } + return new HttpClientTransport(textWireFormat, uri); } @SuppressWarnings("rawtypes") diff --git a/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportFactory.java b/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportFactory.java index b386b44595..036484cf7c 100644 --- a/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportFactory.java +++ b/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportFactory.java @@ -54,6 +54,15 @@ public class HttpsTransportFactory extends HttpTransportFactory { } protected Transport createTransport(URI location, WireFormat wf) throws MalformedURLException { - return new HttpsClientTransport(asTextWireFormat(wf), location); + // need to remove options from uri + URI uri; + try { + uri = URISupport.removeQuery(location); + } catch (URISyntaxException e) { + MalformedURLException cause = new MalformedURLException("Error removing query on " + location); + cause.initCause(e); + throw cause; + } + return new HttpsClientTransport(asTextWireFormat(wf), uri); } }