activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-1698) Support "instance" web deployments
Date Tue, 27 Feb 2018 12:06:00 GMT

    [ https://issues.apache.org/jira/browse/ARTEMIS-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16378473#comment-16378473
] 

ASF GitHub Bot commented on ARTEMIS-1698:
-----------------------------------------

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. 



> Support "instance" web deployments
> ----------------------------------
>
>                 Key: ARTEMIS-1698
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1698
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: Broker
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>
> Currently any web application deployment to the embedded Jetty instance must be done
via the "web" directory of the Artemis "home" installation.  This includes things like the
web console or REST interface.  We should support deployments in the "web" directory of the
Artemis "instance" as well so instances can have better control over what web applications
they deploy.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message