You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Joseph Slag <sl...@citilink.com> on 2000/04/04 06:24:05 UTC

mapping servlet/jsp to servername/ with apache and tomcat

After spending a good amount of time experimenting and coming up
with a solution that I'm not crazy about, I'd like to ask if others
have come up with a better way to do the following:

I want users who come to my site (by typing 'http://sitename.com/' or
following a link to the same URL) to have their request processed by a 
servlet or jsp file.

The only way that I've been able to make this work is by 
  #1) using the default tomcat.conf directive to map .jsp files to tomcat,
  #2) telling Apache to look for DirectoryIndex files of index.jsp and 
          index.html, in that order,
  #3) putting my index.jsp file in /webapps/ROOT/, 
  #4) putting a bogus index.jsp in /htdocs/ 

This seems to convince Apache that it should be serving up an index.jsp file,
which it then does properly by deferring to Tomcat.  Having a bogus index.jsp
in Apache's /htdocs/ dir feels like a kludge, though.  Are there better ways?

Re: mapping servlet/jsp to servername/ with apache and tomcat

Posted by Shachor Gal <sh...@techunix.technion.ac.il>.

On Mon, 3 Apr 2000, Joseph Slag wrote:

> After spending a good amount of time experimenting and coming up
> with a solution that I'm not crazy about, I'd like to ask if others
> have come up with a better way to do the following:
> 
> I want users who come to my site (by typing 'http://sitename.com/' or
> following a link to the same URL) to have their request processed by a 
> servlet or jsp file.
> 
> The only way that I've been able to make this work is by 
>   #1) using the default tomcat.conf directive to map .jsp files to tomcat,
>   #2) telling Apache to look for DirectoryIndex files of index.jsp and 
>           index.html, in that order,
>   #3) putting my index.jsp file in /webapps/ROOT/, 
>   #4) putting a bogus index.jsp in /htdocs/ 
> 
> This seems to convince Apache that it should be serving up an index.jsp file,
> which it then does properly by deferring to Tomcat.  Having a bogus index.jsp
> in Apache's /htdocs/ dir feels like a kludge, though.  Are there better ways?

How about setting the root application docBase to your apache root
directory, putting the WEB-INF in the root directory (and protecting it)

	Gal Shachor