1 Reply Latest reply on Mar 31, 2004 1:36 PM by lonb

    How to serve /index.html?

    kgilpin Newbie

      I have a lot of complicated stuff running in JBoss. EJBs, JSP applications, data sources, etc.

      But I can't figure out how to accomplish a simple task. How can I have JBoss serve an index.html file without a servlet context? In other words:


        • 1. Re: How to serve /index.html?
          lonb Newbie

          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:
          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"

          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.

          This should contain one line:
          Manifest-Version: 1.0

          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,

          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">

          Note the context-root -- that is what causes this to respond at the root directory.