This content has been marked as final.
Show 1 reply
-
1. Re: How to serve /index.html?
lonb Mar 31, 2004 1:36 PM (in response to kgilpin)Keep in mind that JBoss is an app server not a web server, so it is not optimized for serving static content. To server static content you will still need an application context. Make yourself a directory called "something.ear" (yes, you can make directories with an ".ear" extension).
Then make a sub-directory called "sub.war". Put your static content in the directory, such as your index.html file. Make a sub-directory off of sub.war called "WEB-INF". In there put a filed called:
web.xml
The body of web.xml should look like this:<?xml version="1.0"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app>
Then make a second sub-directory off something.ear called "META-INF". I.e., this directory should be at the same hierarchy level as the war directory you made. In this new directory you will need to make three files.
MANIFEST.MF
This should contain one line:Manifest-Version: 1.0
jboss-app.xml
This one should contain three lines:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_3_2.dtd"> <jboss-app />
And finally,
application.xml
This one needs a few more lines:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd"> <application> <display-name>SomeName</display-name> <module> <web> <web-uri>sub.war</web-uri> <context-root>/</context-root> </web> </module> </application>
Note the context-root -- that is what causes this to respond at the root directory.