Author: chirino Date: Mon Mar 21 18:07:43 2011 New Revision: 1083885 URL: http://svn.apache.org/viewvc?rev=1083885&view=rev Log: - Better IPv6 support - make the web_admin element behave more like the connector element. Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Stop.scala activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/WebAdminDTO.java activemq/activemq-apollo/trunk/apollo-dto/src/test/java/org/apache/activemq/apollo/dto/XmlCodecTest.java activemq/activemq-apollo/trunk/apollo-dto/src/test/resources/org/apache/activemq/apollo/dto/XmlCodecTest.xml activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-bdb.xml activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl-secure.xml activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp.xml activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala (original) +++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala Mon Mar 21 18:07:43 2011 @@ -41,7 +41,7 @@ object Connector extends Log { def defaultConfig() = { val rc = new ConnectorDTO rc.id = "default" - rc.bind = "tcp://0.0.0.0:61613" + rc.bind = "tcp://[::]:61613" rc.protocol = "multi" rc.connection_limit = 1000 rc Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala (original) +++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala Mon Mar 21 18:07:43 2011 @@ -29,6 +29,7 @@ import org.fusesource.hawtdispatch._ import java.io.File import java.lang.String import org.apache.activemq.apollo.broker.web.{WebServer, WebServerFactory} +import java.net.URI /** *

@@ -149,9 +150,11 @@ class JettyWebServer(val broker:Broker) val config = broker.config val web_admin = config.web_admin - val prefix = web_admin.prefix.getOrElse("/") - val port = web_admin.port.getOrElse(61680) - val host = web_admin.host.getOrElse("127.0.0.1") + val bind = web_admin.bind.getOrElse("http://127.0.0.1:61680") + val bind_uri = new URI(bind) + val prefix = "/"+bind_uri.getPath.stripPrefix("/") + val host = bind_uri.getHost + val port = bind_uri.getPort // Start up the admin interface... debug("Starting administration interface"); @@ -210,7 +213,7 @@ class JettyWebServer(val broker:Broker) server.start val localPort = connector.getLocalPort - def url = "http://"+host+":" + localPort + prefix + def url = new URI("http", null, host, localPort, prefix, null, null).toString broker.console_log.info("Administration interface available at: "+url) on_completed.run } Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml (original) +++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml Mon Mar 21 18:07:43 2011 @@ -55,10 +55,10 @@ - + - - + + Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml (original) +++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml Mon Mar 21 18:07:43 2011 @@ -55,7 +55,8 @@ - - + + + Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Stop.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Stop.scala?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Stop.scala (original) +++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Stop.scala Mon Mar 21 18:07:43 2011 @@ -23,8 +23,8 @@ import org.apache.activemq.apollo.util.F import org.apache.activemq.apollo.util.OptionSupport._ import org.apache.activemq.apollo.util.Logging import org.apache.commons.codec.binary.Base64 -import java.net.{HttpURLConnection, URL} import org.apache.felix.service.command.CommandSession +import java.net.{URI, HttpURLConnection, URL} /** * The apollo stop command @@ -62,9 +62,12 @@ class Stop extends Action with Logging { error("Web admin not enabled for that configuration, sorry can't shut the broker down"); case Some(web_admin)=> - val prefix = web_admin.prefix.getOrElse("/").stripSuffix("/") - val port = web_admin.port.getOrElse(8080) - val host = web_admin.host.getOrElse("127.0.0.1") + + val bind = web_admin.bind.getOrElse("http://localhost:61680") + val bind_uri = new URI(bind) + val prefix = bind_uri.getPath.stripSuffix("/") + val host = "localhost" + val port = bind_uri.getPort val auth = (user, password) match { case (null,null)=> None Modified: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml (original) +++ activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml Mon Mar 21 18:07:43 2011 @@ -21,5 +21,5 @@ localhost - + Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/WebAdminDTO.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/WebAdminDTO.java?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/WebAdminDTO.java (original) +++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/WebAdminDTO.java Mon Mar 21 18:07:43 2011 @@ -33,12 +33,6 @@ import java.util.Set; public class WebAdminDTO { @XmlAttribute - public String host; - - @XmlAttribute - public Integer port; - - @XmlAttribute - public String prefix; + public String bind; } Modified: activemq/activemq-apollo/trunk/apollo-dto/src/test/java/org/apache/activemq/apollo/dto/XmlCodecTest.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/test/java/org/apache/activemq/apollo/dto/XmlCodecTest.java?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-dto/src/test/java/org/apache/activemq/apollo/dto/XmlCodecTest.java (original) +++ activemq/activemq-apollo/trunk/apollo-dto/src/test/java/org/apache/activemq/apollo/dto/XmlCodecTest.java Mon Mar 21 18:07:43 2011 @@ -81,7 +81,7 @@ public class XmlCodecTest { ConnectorDTO connector = new ConnectorDTO(); connector.id = "port-61616"; - connector.bind = "tcp://0.0.0.0:61616"; + connector.bind = "tcp://[::]:61616"; broker.connectors.add(connector); XmlCodec.marshalBrokerDTO(broker, System.out, true); Modified: activemq/activemq-apollo/trunk/apollo-dto/src/test/resources/org/apache/activemq/apollo/dto/XmlCodecTest.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/test/resources/org/apache/activemq/apollo/dto/XmlCodecTest.xml?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-dto/src/test/resources/org/apache/activemq/apollo/dto/XmlCodecTest.xml (original) +++ activemq/activemq-apollo/trunk/apollo-dto/src/test/resources/org/apache/activemq/apollo/dto/XmlCodecTest.xml Mon Mar 21 18:07:43 2011 @@ -33,7 +33,7 @@ - + GroupId UserId Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-bdb.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-bdb.xml?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-bdb.xml (original) +++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-bdb.xml Mon Mar 21 18:07:43 2011 @@ -18,8 +18,6 @@ Has a BDB store enabled. - - localhost @@ -28,6 +26,7 @@ - + + \ No newline at end of file Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml (original) +++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-secure.xml Mon Mar 21 18:07:43 2011 @@ -57,7 +57,7 @@ - + Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl-secure.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl-secure.xml?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl-secure.xml (original) +++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl-secure.xml Mon Mar 21 18:07:43 2011 @@ -30,6 +30,6 @@ - + \ No newline at end of file Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml (original) +++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-ssl.xml Mon Mar 21 18:07:43 2011 @@ -23,6 +23,6 @@ - + \ No newline at end of file Modified: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp.xml?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp.xml (original) +++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp.xml Mon Mar 21 18:07:43 2011 @@ -25,6 +25,6 @@ - + \ No newline at end of file Modified: activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java (original) +++ activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/TcpTransportServer.java Mon Mar 21 18:07:43 2011 @@ -55,10 +55,7 @@ public class TcpTransportServer implemen public TcpTransportServer(URI location) throws UnknownHostException { bindScheme = location.getScheme(); String host = location.getHost(); - host = (host == null || host.length() == 0) ? "localhost" : host; - if (host.equals("localhost")) { - host = "0.0.0.0"; - } + host = (host == null || host.length() == 0) ? "::" : host; bindAddress = new InetSocketAddress(InetAddress.getByName(host), location.getPort()); } @@ -128,11 +125,19 @@ public class TcpTransportServer implemen } public String getBoundAddress() { - return bindScheme+"://"+bindAddress.getAddress()+":"+channel.socket().getLocalPort(); + try { + return new URI(bindScheme, null, bindAddress.getAddress().getHostAddress(), channel.socket().getLocalPort(), null, null, null).toString(); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } } public String getConnectAddress() { - return bindScheme+"://"+resolveHostName()+":"+channel.socket().getLocalPort(); + try { + return new URI(bindScheme, null, resolveHostName(), channel.socket().getLocalPort(), null, null, null).toString(); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } } Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md?rev=1083885&r1=1083884&r2=1083885&view=diff ============================================================================== --- activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md (original) +++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Mon Mar 21 18:07:43 2011 @@ -82,7 +82,7 @@ single connector. localhost - + {pygmentize} @@ -118,7 +118,7 @@ header of messages to the id of user tha use the following configuration: {pygmentize:: xml} - + {pygmentize} @@ -391,7 +391,7 @@ Example: file="${apollo.base}/etc/keystore" password="password" key_password="password"/> - + ... {pygmentize} @@ -438,7 +438,7 @@ to `false`. cheeze.com - + {pygmentize} @@ -694,17 +694,14 @@ For example: {pygmentize:: xml} ... - + ... {pygmentize} A `web_admin` element may be configured with the following attributes: -* `host` : The amount of memory buffer space allocated for each queue. -* `port` : The amount of memory buffer space allocated to each -* `prefix` : The prefix path to the web administration application -* `enabled` : If set to false then web administration is disabled. +* `bind` : The address and port to bind the web interface on in URL syntax. ## Managing Brokers