2 Replies Latest reply on Jul 12, 2016 8:45 AM by mjobanek

    Define the context path of a WAR added

    cmoulliard

      Hi,

       

      When I configure Shrinkwrap as such

       

      WebArchive archive = ShrinkWrap.createFromZipFile(WebArchive.class,new File("/Users/chmoulli/Temp/test-swarm/demo/src/hawtio-default-1.4.65.war"));
      
      swarm.start();
      swarm.deploy(archive);
      

       

      my war is well deployed but using the name of the war as Web context Path.

       

      2016-06-30 14:12:29,120 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) WFLYSRV0027: Starting deployment of "hawtio-default-1.4.65.war" (runtime-name: "hawtio-default-1.4.65.war")
      INFO  | ServerService Thread Pool -- 10 | Configuration will be discovered via JNDI
      2016-06-30 14:12:32,726 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 10) WFLYUT0021: Registered web context: /hawtio-default-1.4.65
      

       

      Is it possible to specify the context patg ("/hawtio") ?

       

      Regards,

       

      Charles

        • 1. Re: Define the context path of a WAR added
          cmoulliard

          Here is the solution --> archive.setContextRoot("/hawtio");

          • 2. Re: Define the context path of a WAR added
            mjobanek

            Hi,

            your solution is probably possible only for WARArchive from the wildfly-swarm-core library.

            For the general usage (on the level of the ShrinkWrap library) I know one workaround:

            WebArchive hawtioArchive = ShrinkWrap.create(WebArchive.class, "hawtio.war").merge(archive);
            

            which basically means that you create a new empty archive with the desired name and merge it with the original archive.

            Yeah, it's not nice solution but it is feasible :-).