You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Martin Leboeuf <ma...@tecsys.com> on 2000/02/22 18:48:11 UTC

Configuring Tomcat

Hi !

I developed a Web app based on the Model 2 architecture i.e. a single
controller servlet dispatching to which ever oder service based on the
request URL. Because I have a dedicated
webserver for my app, I would like to configure Tomcat so that whatever URL
is given, the webserver will always call the controller servlet. In other
words, achieve a mapping like :

http://www.company.com/*  will always hit the controller servlet.

I tried many variation on the following mapping in WEB-INF/web.xml :

<web-app>
    <servlet>
        <servlet-name>
            MyServlet
        </servlet-name>
        <servlet-class>
            my.package.MyControllerServlet
        </servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>
            MyServlet
        </servlet-name>
        <url-pattern>
            /*
        </url-pattern>
    </servlet-mapping>
</web-app>

but to no avail. What I am doing wrong ? How can I define the desired
mapping ?

Here is a second, related question : by default, the index.html file of a
context (defined in server.xml) is called when no specific file is asked
for. If index.html is not there, the content of the context directory is
shown which IMHO, is a bad thing. How can I configure Tomcat to issue a 404
error instead ?

Thanx for your help, Martin.

martinl@tecsys.com