[TOMCAT] I want to hide "/index.jsp" and having "/" at the root of my site

R

RGonzalez

in conf/web.xml look at this:

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


These are the default URI in order it will look for when browsing to your
site at "/".
 
X

Xavier Tarrago

Dont understant why you could want that, but:
- Remove <welcome-file>
- Add a servlet mapping for / to a servlet (say Welcome)
- In the servlet Welcome, just forward
(Servletcontext;getRequestdispatcher, etc...) to index.jsp

I did not try that, but I know that when using a requestDispatcher, only
original request is seen by the browser. Maybe it could work ;-)
 
W

Wendy S

Frogger said:
I have a webapp with a welcome file called "index.jsp".
When i visit my site http://www.mysite.com/ , it convert the url in
http://www.mysite.com/index.jsp !!
I don't want to see index.jsp but only "/"
Can you help me ? Thanx

Tomcat (4.1 at least) does this on purpose, the behavior was put in as part
of a bug fix in an earlier version and you can't turn it off. There was
talk on tomcat-dev of making it configurable (redirect vs. forward) in 5.0
but I have no idea if it went in or not. Search the tomcat-user or
tomcat-dev mailing list archives for more info.

Info on why it's that way, quoted from the Tomcat source:
http://w6.metronet.com/~wjm/tomcat/2001/Apr/msg00251.html

Here's an article that tells how to patch the Tomcat source to make it stop
redirecting:
http://www.spaceprogram.com/knowledge/fixingtomcat_302problem.html

You can run Apache in front of Tomcat and probably get rid of the URL change
that way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top