You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chris Bailey <ch...@codeintensity.com> on 2002/06/19 01:19:24 UTC

Way to remove index page file name from URL?

I have a web app with a few servlets.  One of these servlets I'd like to be
the "default" servlet - basically it should handle any request that the
other servlets don't handle, or that isn't for an image file or other
resource.  So far, I've set this up by mapping a special index/welcome page
name to the servlet.  i.e. with <url-mapping>*.mypage</url-mapping>, and
then setting "index.mypage" as one of the welcome files.  This works nicely,
but the only problem is that on Tomcat (and maybe others), "index.mypage"
now shows up in the URL.  For example, if the original URL the user typed in
was "http://www.foo.com/", their browser will now show
"http://www.foo.com/index.mypage".

Is there any way to have Tomcat not set the location to the URL with the
index.mypage in it?

I should note, this shall be the only webapp for this instance of Tomcat, so
if I need to redo my context somehow to achieve this, that's fine.
Currently the context looks like:

  <Context path="" docBase="foo" ...>

I will need to be able to deploy it as both a WAR, and an expanded
webapp/non-WAR (for development).
____
Chris Bailey       mailto:chris@codeintensity.com
Code Intensity       http://www.codeintensity.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Way to remove index page file name from URL?

Posted by Dennis van den Berg <dv...@xs4all.nl>.
Hi,

You can make it work by mapping your "default" servlet to "/" and make this
one forward to your homepage using requestdispatcher. A disadvantage of this
solution is that this overides the default mappings for your static image/js
files etc. You can solve this by mapping each of these files to the default
servlet provided by tomcat (which is named "default") which just serves
files by using extension mapping.

I don't know if there is a better solution but this works fine for me.

Dennis.

-----Original Message-----
From: Chris Bailey [mailto:chris@codeintensity.com]
Sent: woensdag 19 juni 2002 1:19
To: Tomcat Mailing List
Subject: Way to remove index page file name from URL?


I have a web app with a few servlets.  One of these servlets I'd like to be
the "default" servlet - basically it should handle any request that the
other servlets don't handle, or that isn't for an image file or other
resource.  So far, I've set this up by mapping a special index/welcome page
name to the servlet.  i.e. with <url-mapping>*.mypage</url-mapping>, and
then setting "index.mypage" as one of the welcome files.  This works nicely,
but the only problem is that on Tomcat (and maybe others), "index.mypage"
now shows up in the URL.  For example, if the original URL the user typed in
was "http://www.foo.com/", their browser will now show
"http://www.foo.com/index.mypage".

Is there any way to have Tomcat not set the location to the URL with the
index.mypage in it?

I should note, this shall be the only webapp for this instance of Tomcat, so
if I need to redo my context somehow to achieve this, that's fine.
Currently the context looks like:

  <Context path="" docBase="foo" ...>

I will need to be able to deploy it as both a WAR, and an expanded
webapp/non-WAR (for development).
____
Chris Bailey       mailto:chris@codeintensity.com
Code Intensity       http://www.codeintensity.com


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>