You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by jbertram <gi...@git.apache.org> on 2018/02/22 19:48:55 UTC

[GitHub] activemq-artemis pull request #1889: ARTEMIS-1698 support 'instance' web dep...

GitHub user jbertram opened a pull request:

    https://github.com/apache/activemq-artemis/pull/1889

    ARTEMIS-1698 support 'instance' web deployments

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jbertram/activemq-artemis ARTEMIS-1698

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/1889.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1889
    
----
commit 63bd0b01aeda51c852d63cd4ab3ed845a9519ce1
Author: Justin Bertram <jb...@...>
Date:   2017-11-17T18:18:21Z

    ARTEMIS-1698 support 'instance' web deployments

----


---

[GitHub] activemq-artemis pull request #1889: ARTEMIS-1698 support 'instance' web dep...

Posted by gaohoward <gi...@git.apache.org>.
Github user gaohoward commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1889#discussion_r170900438
  
    --- Diff: artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java ---
    @@ -95,34 +95,51 @@ public void configure(ComponentDTO config, String artemisInstance, String artemi
     
           handlers = new HandlerList();
     
    -      Path warDir = Paths.get(artemisHome != null ? artemisHome : ".").resolve(webServerConfig.path).toAbsolutePath();
    +      Path homeWarDir = Paths.get(artemisHome != null ? artemisHome : ".").resolve(webServerConfig.path).toAbsolutePath();
    +      Path instanceWarDir = Paths.get(artemisInstance != null ? artemisInstance : ".").resolve(webServerConfig.path).toAbsolutePath();
     
           if (webServerConfig.apps != null && webServerConfig.apps.size() > 0) {
              webContexts = new ArrayList<>();
              for (AppDTO app : webServerConfig.apps) {
    -            WebAppContext webContext = deployWar(app.url, app.war, warDir);
    +            Path dirToUse = homeWarDir;
    +            if (new File(instanceWarDir.toFile().toString() + File.separator + app.war).exists()) {
    +               dirToUse = instanceWarDir;
    +            }
    +            WebAppContext webContext = deployWar(app.url, app.war, dirToUse);
                 webContexts.add(webContext);
                 if (app.war.startsWith("console")) {
                    consoleUrl = webServerConfig.bind + "/" + app.url;
                 }
              }
           }
     
    -      ResourceHandler resourceHandler = new ResourceHandler();
    -      resourceHandler.setResourceBase(warDir.toString());
    -      resourceHandler.setDirectoriesListed(false);
    -      resourceHandler.setWelcomeFiles(new String[]{"index.html"});
    +      ResourceHandler homeResourceHandler = new ResourceHandler();
    +      homeResourceHandler.setResourceBase(homeWarDir.toString());
    +      homeResourceHandler.setDirectoriesListed(false);
    +      homeResourceHandler.setWelcomeFiles(new String[]{"index.html"});
    +
    +      ContextHandler homeContext = new ContextHandler();
    +      homeContext.setContextPath("/");
    +      homeContext.setResourceBase(homeWarDir.toString());
    +      homeContext.setHandler(homeResourceHandler);
    +      homeContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
    +
    +      ResourceHandler instanceResourceHandler = new ResourceHandler();
    +      instanceResourceHandler.setResourceBase(instanceWarDir.toString());
    +      instanceResourceHandler.setDirectoriesListed(false);
    +      instanceResourceHandler.setWelcomeFiles(new String[]{"index.html"});
    +
    +      ContextHandler instanceContext = new ContextHandler();
    +      instanceContext.setContextPath("/");
    +      instanceContext.setResourceBase(instanceWarDir.toString());
    +      instanceContext.setHandler(instanceResourceHandler);
    +      homeContext.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
    --- End diff --
    
    @jbertram It looks like setting two root ("/") resource handlers can cause confusion. According to my test when 'index.html' appears in both {home}/web and {instance}/web, it picks up the one in {home}/web. 



---

[GitHub] activemq-artemis pull request #1889: ARTEMIS-1698 support 'instance' web dep...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/activemq-artemis/pull/1889


---