You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/05/05 05:03:12 UTC

[1/2] activemq-artemis git commit: Fixing WebServer integration after created server

Repository: activemq-artemis
Updated Branches:
  refs/heads/master bebd8093c -> 9843f5f31


Fixing WebServer integration after created server

The web page was not loading


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/2a6422bc
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/2a6422bc
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/2a6422bc

Branch: refs/heads/master
Commit: 2a6422bc6f8bf07b2f82ea8552775c2517e44376
Parents: bebd809
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon May 4 18:33:53 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 4 22:44:32 2015 -0400

----------------------------------------------------------------------
 .../artemis/cli/commands/Configurable.java       | 19 +++++++++++++++++++
 .../activemq/artemis/cli/commands/Run.java       |  2 +-
 .../artemis/components/ExternalComponent.java    |  2 +-
 .../artemis/component/WebServerComponent.java    | 12 ++++++------
 .../artemis/test/WebServerComponentTest.java     | 12 ++++++------
 5 files changed, 33 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2a6422bc/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Configurable.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Configurable.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Configurable.java
index 404b746..7f695a7 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Configurable.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Configurable.java
@@ -42,6 +42,8 @@ public abstract class Configurable
 
    private String brokerInstance;
 
+   private String brokerHome;
+
    private FileConfiguration fileConfiguration;
 
    protected String getBrokerInstance()
@@ -61,6 +63,23 @@ public abstract class Configurable
       return brokerInstance;
    }
 
+   protected String getBrokerHome()
+   {
+      if (brokerHome == null)
+      {
+         /* We use File URI for locating files.  The ARTEMIS_HOME variable is used to determine file paths.  For Windows
+         the ARTEMIS_HOME variable will include back slashes (An invalid file URI character path separator).  For this
+         reason we overwrite the ARTEMIS_HOME variable with backslashes replaced with forward slashes. */
+         brokerHome = System.getProperty("artemis.home");
+         if (brokerHome != null)
+         {
+            brokerHome = brokerHome.replace("\\", "/");
+            System.setProperty("artemis.home", brokerHome);
+         }
+      }
+      return brokerHome;
+   }
+
 
    protected FileConfiguration getFileConfiguration() throws Exception
    {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2a6422bc/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
index 3aa6c96..8a278e7 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Run.java
@@ -66,7 +66,7 @@ public class Run extends Configurable implements Action
       {
          Class clazz = this.getClass().getClassLoader().loadClass(componentDTO.componentClassName);
          ExternalComponent component = (ExternalComponent)clazz.newInstance();
-         component.configure(componentDTO, getBrokerInstance());
+         component.configure(componentDTO, getBrokerInstance(), getBrokerHome());
          component.start();
          components.add(component);
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2a6422bc/artemis-cli/src/main/java/org/apache/activemq/artemis/components/ExternalComponent.java
----------------------------------------------------------------------
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/components/ExternalComponent.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/components/ExternalComponent.java
index 9317c1b..88398c7 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/components/ExternalComponent.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/components/ExternalComponent.java
@@ -21,5 +21,5 @@ import org.apache.activemq.artemis.dto.ComponentDTO;
 
 public interface ExternalComponent extends ActiveMQComponent
 {
-   void configure(ComponentDTO config, String activemqHome) throws Exception;
+   void configure(ComponentDTO config, String artemisInstance, String artemisHome) throws Exception;
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2a6422bc/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
----------------------------------------------------------------------
diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
index 665f03b..0ef6de3 100644
--- a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
+++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.artemis.component;
 
+import java.net.URI;
+
 import org.apache.activemq.artemis.components.ExternalComponent;
 import org.apache.activemq.artemis.dto.AppDTO;
 import org.apache.activemq.artemis.dto.ComponentDTO;
@@ -28,8 +30,6 @@ import org.eclipse.jetty.server.handler.ResourceHandler;
 import org.eclipse.jetty.server.nio.SelectChannelConnector;
 import org.eclipse.jetty.webapp.WebAppContext;
 
-import java.net.URI;
-
 public class WebServerComponent implements ExternalComponent
 {
 
@@ -38,7 +38,7 @@ public class WebServerComponent implements ExternalComponent
    private WebServerDTO webServerConfig;
 
    @Override
-   public void configure(ComponentDTO config, String activemqHome) throws Exception
+   public void configure(ComponentDTO config, String artemisInstance, String artemisHome) throws Exception
    {
       webServerConfig = (WebServerDTO)config;
       String path = webServerConfig.path.startsWith("/") ? webServerConfig.path : "/" + webServerConfig.path;
@@ -56,17 +56,17 @@ public class WebServerComponent implements ExternalComponent
       {
          for (AppDTO app : webServerConfig.apps)
          {
-            deployWar(app.url, app.war, activemqHome, path);
+            deployWar(app.url, app.war, artemisHome, path);
          }
       }
 
       WebAppContext handler = new WebAppContext();
       handler.setContextPath("/");
-      handler.setResourceBase(activemqHome + path);
+      handler.setResourceBase(artemisHome + path);
       handler.setLogUrlOnStart(true);
 
       ResourceHandler resourceHandler = new ResourceHandler();
-      resourceHandler.setResourceBase(activemqHome + path);
+      resourceHandler.setResourceBase(artemisHome + path);
       resourceHandler.setDirectoriesListed(true);
       resourceHandler.setWelcomeFiles(new String[]{"index.html"});
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/2a6422bc/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java
----------------------------------------------------------------------
diff --git a/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java b/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java
index 71e1860..4acaac1 100644
--- a/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java
+++ b/artemis-web/src/test/java/org/apache/activemq/artemis/test/WebServerComponentTest.java
@@ -16,6 +16,11 @@
  */
 package org.apache.activemq.artemis.test;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandlerContext;
@@ -39,11 +44,6 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
 public class WebServerComponentTest extends Assert
 {
    static final String URL = System.getProperty("url", "http://localhost:8161/WebServerComponentTest.txt");
@@ -64,7 +64,7 @@ public class WebServerComponentTest extends Assert
       webServerDTO.bind = "http://localhost:8161";
       webServerDTO.path = "webapps";
       WebServerComponent webServerComponent = new WebServerComponent();
-      webServerComponent.configure(webServerDTO, "./src/test/resources/");
+      webServerComponent.configure(webServerDTO, "./src/test/resources/", "./src/test/resources/");
       webServerComponent.start();
       // Make the connection attempt.
       CountDownLatch latch = new CountDownLatch(1);


[2/2] activemq-artemis git commit: this closes #223 on fixing web server integration

Posted by cl...@apache.org.
this closes #223 on fixing web server integration


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/9843f5f3
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/9843f5f3
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/9843f5f3

Branch: refs/heads/master
Commit: 9843f5f317c2561b8ece692d7bc9829d96cdaae6
Parents: bebd809 2a6422b
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon May 4 23:01:58 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon May 4 23:01:58 2015 -0400

----------------------------------------------------------------------
 .../artemis/cli/commands/Configurable.java       | 19 +++++++++++++++++++
 .../activemq/artemis/cli/commands/Run.java       |  2 +-
 .../artemis/components/ExternalComponent.java    |  2 +-
 .../artemis/component/WebServerComponent.java    | 12 ++++++------
 .../artemis/test/WebServerComponentTest.java     | 12 ++++++------
 5 files changed, 33 insertions(+), 14 deletions(-)
----------------------------------------------------------------------