https://issues.apache.org/jira/browse/AMQ-3918 - don't bind http based transports to local host name and do better url registering

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1389776 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2012-09-25 09:44:20 +00:00
parent 08185743c1
commit fa29678c54
5 changed files with 9 additions and 18 deletions

View File

@ -955,7 +955,7 @@
<exclude>org/apache/activemq/store/jdbc/JDBCStoreBrokerTest.*</exclude>
<exclude>org/apache/activemq/broker/ft/MasterSlaveSlaveDieTest.*</exclude>
<exclude>org/apache/activemq/security/XBeanSecurityWithGuestNoCredentialsOnlyTest.*</exclude>
<exclude>org/apache/activemq/store/kahadb/plist/PListTest.*</exclude>
</excludes>
</configuration>
</plugin>

View File

@ -62,7 +62,6 @@ public class TransportConnector implements Connector, BrokerServiceAware {
private DiscoveryAgent discoveryAgent;
private final ConnectorStatistics statistics = new ConnectorStatistics();
private URI discoveryUri;
private URI connectUri;
private String name;
private boolean disableAsyncDispatch;
private boolean enableStatusMonitor = false;
@ -105,7 +104,6 @@ public class TransportConnector implements Connector, BrokerServiceAware {
public ManagedTransportConnector asManagedConnector(ManagementContext context, ObjectName connectorName) throws IOException, URISyntaxException {
ManagedTransportConnector rc = new ManagedTransportConnector(context, connectorName, getServer());
rc.setBrokerInfo(getBrokerInfo());
rc.setConnectUri(getConnectUri());
rc.setDisableAsyncDispatch(isDisableAsyncDispatch());
rc.setDiscoveryAgent(getDiscoveryAgent());
rc.setDiscoveryUri(getDiscoveryUri());
@ -345,17 +343,12 @@ public class TransportConnector implements Connector, BrokerServiceAware {
}
public URI getConnectUri() throws IOException, URISyntaxException {
if (connectUri == null) {
if (server != null) {
connectUri = server.getConnectURI();
return server.getConnectURI();
} else {
return uri;
}
}
return connectUri;
}
public void setConnectUri(URI transportUri) {
this.connectUri = transportUri;
}
public void onStarted(TransportConnection connection) {
connections.add(connection);

View File

@ -43,14 +43,14 @@ abstract public class WebTransportServerSupport extends TransportServerSupport {
bindHost = (bindHost == null || bindHost.length() == 0) ? "localhost" : bindHost;
InetAddress addr = InetAddress.getByName(bindHost);
host = addr.getCanonicalHostName();
if (addr.isAnyLocalAddress()) {
host = InetAddressUtil.getLocalHostName();
}
connector.setHost(host);
connector.setPort(bindAddress.getPort());
connector.setServer(server);
server.addConnector(connector);
if (addr.isAnyLocalAddress()) {
host = InetAddressUtil.getLocalHostName();
}
setConnectURI(new URI(bind.getScheme(), bind.getUserInfo(), host, bindAddress.getPort(), bind.getPath(), bind.getQuery(), bind.getFragment()));
}
}

View File

@ -95,7 +95,6 @@ public class HttpTransportServer extends WebTransportServerSupport {
contextHandler.setHandler(gzipHandler);
server.start();
setConnectURI(new URI(bind.getScheme(), bind.getUserInfo(), host, connector.getLocalPort(), bind.getPath(), bind.getQuery(), bind.getFragment()));
}
protected void doStop(ServiceStopper stopper) throws Exception {

View File

@ -72,7 +72,6 @@ public class WSTransportServer extends WebTransportServerSupport {
contextHandler.setAttribute("acceptListener", getAcceptListener());
server.start();
setConnectURI(new URI(bind.getScheme(), bind.getUserInfo(), host, connector.getLocalPort(), bind.getPath(), bind.getQuery(), bind.getFragment()));
}
protected void doStop(ServiceStopper stopper) throws Exception {