Search code examples
thorntail

How to set the Web application context in Thorntail?



I'm looking for a way to customize the Web application name (so to change the Web context accordingly) in Thorntail. I assume that it can be done through the thorntail's maven plugin but I cannot find which is the property to set for it. Thanks


Solution

  • By default, the context is /, which should be what you want most of the time. To customize it, you can use one of the following options:

    1) Pass the thorntail.context.path system property when starting the uberjar: java -jar my-app-thorntail.jar -Dthorntail.context.path=my-context.

    2) If you use project-defaults.yml, you can configure it there:

    thorntail:
      context:
        path: my-context
    

    3) Create a file WEB-INF/jboss-web.xml with this content:

    <jboss-web>
      <context-root>my-context</context-root>
    </jboss-web>
    

    (Under the hood, options 1 and 2 are actually transformed to 3, but you don't have to care.)