Quick but useful change to Tomcat

Although I usually like to focus on tips and tricks for BusinessObjects software, I occassionally run across something that I which I had known a long time ago.  As a BusinessObjects administrator how often have you mistyped the URL that takes you to InfoView?  Wouldn’t it be nice if you just typed in the server name and it would take you to the InfoView login page?  Well, the change is quite easy.

How do I override the default home page loaded by Tomcat?

After successfully installing Tomcat, you usually test it by loading http://localhost:8080. The contents of that page are compiled into the index_jsp servlet and therefore warns against modifying the index.jsp files.   Inside $TOMCAT_HOME/conf/web.xml , we can configure which files Tomcat searches for when a directory is specified.  This page was traditionally called a welcome page and all application servers allow you to configure to defaults.  In your web.xml file, look for a section called <welcome-file-list>.  It should look something like:

        <welcome-file-list>
                <welcome-file>index.html</welcome-file>
                <welcome-file>index.htm</welcome-file>
                <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>

The default servlet attempts to load the welcome page in the order listed: index.html, index.htm and finally index.jsp.  You can override the index.jsp file by creating an index.html file at $TOMCAT_HOME/webapps/ROOT.  In each directory of my website, I always create an index.html that does a redirect to the correct URL.  This helps avoid the issue of directory listings. Here is an example of a URL redirect:

        <HTML>
        <HEAD>
        <META http-equiv="refresh" content="0;URL=http://mydomain.com/InfoViewApp/logon.jsp">
        </HEAD>
        <BODY></BODY>
        </HTML>

NOTE: This change takes effect immediately and does not require a restart of Tomcat.