[jboss-user] [Beginners Corner] - Re: Serving Static Content JBoss5.0.0.GA

PeterJ do-not-reply at jboss.com
Mon Feb 23 12:26:05 EST 2009


Darn, that was an old post and they renamed the file, and I didn't double-check the name. Sorry. Look in conf/bootstrap/profile-repository.xml. You want to add a new entry to the applicationURIs property of the SerializableDeploymentRepositoryFactory bean.

As I mentioned, you need to place the static content into a directory that has a .war suffix and the directory you use for applicationURIs must be the parent of that directory. Assume this is your static content:

/opt/stuff/content.war/some.css
/opt/stuff/content.war/mugshot.png

Then set applicationURIs as follows:

<property name="applicationURIs">
  |   <array elementClass="java.net.URI">
  |     <value>${jboss.server.home.url}deploy</value>
  |     <value>/opt/stuff</value>
  |    </array>
  | </property>

In addition, you will want these files:

/opt/stuff/content.war/WEB-INF/web.xml
/opt/stuff/content.war/WEB-INF/jboss-web.xml

The web.xml can be empty:

<web-app></web-app>

The jboss-web.xml can set the root context:

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

Then also remove the ROOT.war from the deploy directory (it also uses '/' as the context and you cant have two wab apps wit the same root context).

Now you should be able to access you static content as, for example http://localhost:8080/some.css

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4212358#4212358

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4212358



More information about the jboss-user mailing list