Vinny
Vinny

Reputation: 797

What is the simplest way to serve static content in JBoss 5 from a war file?

I want to deploy static content (html,css,js) to an existing JBoss 5.1 server in a war file. Is there a simple web.xml I can create that will work for jboss? Are there jboss specific gotchas?

Upvotes: 2

Views: 4266

Answers (1)

Chris Z
Chris Z

Reputation: 357

If the war is only serving static files, web.xml is optional or you can leave the web-app element blank. The context root will be the same as the war file name by default, and you would need to create a jboss-web.xml file in the WEB-INF directory to change it (so app.war would deploy to http://localhost/app by default). Directories and files next to WEB-INF in the war directory structure will be made public.
Example jboss-web.xml that only changes the context root

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

Upvotes: 6

Related Questions