By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,510 Members | 1,815 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,510 IT Pros & Developers. It's quick & easy.

Tomcat configuration question

P: n/a

I'm using Tomcat in standalone mode. When a URL without a filename is
entered into the browser (ie. "http://myhost.mydomain.com"), and the
default path does NOT have an index.html, but rather an index.jsp
file, Tomcat response with an "HTTP/1.1 302 Moved Temporarily" and a
"Location: http://myhost.mydomain.com/index.jsp" ... I was wondering
if there is a configuration for tomcat that can stop this behavior,
i.e., just run index.jsp?
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a

"DaiIchi" <da*****@agentnews.test.xhome.us> wrote in message
news:62********************************@4ax.com...
|
| I'm using Tomcat in standalone mode. When a URL without a filename is
| entered into the browser (ie. "http://myhost.mydomain.com"), and the
| default path does NOT have an index.html, but rather an index.jsp
| file, Tomcat response with an "HTTP/1.1 302 Moved Temporarily" and a
| "Location: http://myhost.mydomain.com/index.jsp" ... I was wondering
| if there is a configuration for tomcat that can stop this behavior,
| i.e., just run index.jsp?
|

Yes, you can set up the welcome file using web.xml see the dtd
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd
--
-P
Jul 17 '05 #2

P: n/a
On Sun, 23 Nov 2003 21:02:59 -0800, DaiIchi
<da*****@agentnews.test.xhome.us> wrote:

I'm using Tomcat in standalone mode. When a URL without a filename is
entered into the browser (ie. "http://myhost.mydomain.com"), and the
default path does NOT have an index.html, but rather an index.jsp
file, Tomcat response with an "HTTP/1.1 302 Moved Temporarily" and a
"Location: http://myhost.mydomain.com/index.jsp" ... I was wondering
if there is a configuration for tomcat that can stop this behavior,
i.e., just run index.jsp?

Answer to my own question. I was using Tomcat 4.1.x... and with that
version, it is impossible. With Tomcat 3, you can use the
StaticInterceptor useInternal="true". But Tomcat 4 doesn't support
any such thing.

You can fix this by modifying the DefaultServlet, but that's about it.

Rumor has it that this problem was fixed in Tomcat 5. Does anyone
know if it is?

Jul 17 '05 #3

P: n/a
On Mon, 24 Nov 2003 19:38:01 -0000, "PerfectDayToChaseTornados"
<pd***@emailaddress.invalid> wrote:

"DaiIchi" <da*****@agentnews.test.xhome.us> wrote in message
news:62********************************@4ax.com.. .
|
| I'm using Tomcat in standalone mode. When a URL without a filename is
| entered into the browser (ie. "http://myhost.mydomain.com"), and the
| default path does NOT have an index.html, but rather an index.jsp
| file, Tomcat response with an "HTTP/1.1 302 Moved Temporarily" and a
| "Location: http://myhost.mydomain.com/index.jsp" ... I was wondering
| if there is a configuration for tomcat that can stop this behavior,
| i.e., just run index.jsp?
|

Yes, you can set up the welcome file using web.xml see the dtd
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd


Thanks, but the issue isn't the welcome file. The problem is that
Tomcat returns a 302 error to force the browser to redirect to the
"real" page. And there is no way in Tomcat 4.1 to turn it off.
Jul 17 '05 #4

P: n/a
DaiIchi wrote:
On Mon, 24 Nov 2003 19:38:01 -0000, "PerfectDayToChaseTornados"
<pd***@emailaddress.invalid> wrote:

"DaiIchi" <da*****@agentnews.test.xhome.us> wrote in message
news:62********************************@4ax.com. ..
|
| I'm using Tomcat in standalone mode. When a URL without a filename is
| entered into the browser (ie. "http://myhost.mydomain.com"), and the
| default path does NOT have an index.html, but rather an index.jsp
| file, Tomcat response with an "HTTP/1.1 302 Moved Temporarily" and a
| "Location: http://myhost.mydomain.com/index.jsp" ... I was wondering
| if there is a configuration for tomcat that can stop this behavior,
| i.e., just run index.jsp?
|

Yes, you can set up the welcome file using web.xml see the dtd
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd


Thanks, but the issue isn't the welcome file. The problem is that
Tomcat returns a 302 error to force the browser to redirect to the
"real" page. And there is no way in Tomcat 4.1 to turn it off.


I'm surprised, because I use Tomcat 4.1.29 and when I point my browser to
http://localhost:8080/myapp then I will get nicely my index.jsp that I have
defined in my web.xml settings. No hassle with error 302.
Brgds,
Herman
--
Suse Linux Professional 8.1 on Athlon 1.1 Ghz 512 Mb
Anti Spam = remove the "dot" and the "at"
Registered Linux User #264690
Jul 17 '05 #5

P: n/a
On Thu, 27 Nov 2003 16:55:18 +0100, Herman Timmermans
<ti********************@skynet.be> wrote:
DaiIchi wrote:
On Mon, 24 Nov 2003 19:38:01 -0000, "PerfectDayToChaseTornados"
<pd***@emailaddress.invalid> wrote:

"DaiIchi" <da*****@agentnews.test.xhome.us> wrote in message
news:62********************************@4ax.com ...
|
| I'm using Tomcat in standalone mode. When a URL without a filename is
| entered into the browser (ie. "http://myhost.mydomain.com"), and the
| default path does NOT have an index.html, but rather an index.jsp
| file, Tomcat response with an "HTTP/1.1 302 Moved Temporarily" and a
| "Location: http://myhost.mydomain.com/index.jsp" ... I was wondering
| if there is a configuration for tomcat that can stop this behavior,
| i.e., just run index.jsp?
|

Yes, you can set up the welcome file using web.xml see the dtd
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd


Thanks, but the issue isn't the welcome file. The problem is that
Tomcat returns a 302 error to force the browser to redirect to the
"real" page. And there is no way in Tomcat 4.1 to turn it off.


I'm surprised, because I use Tomcat 4.1.29 and when I point my browser to
http://localhost:8080/myapp then I will get nicely my index.jsp that I have
defined in my web.xml settings. No hassle with error 302.
Brgds,
Herman


If myapp is a directory (not a web application), Tomcat will send a
302 Error to redirect your browser to
http://localhost:8080/myapp/index.jsp. This is completely invisible
to the user, so everything looks fine. The problem really occurs if
your JSP handles username/password authentication i.e.
http://username:password@localhost:8080/myapp What happens is that
Tomcat will send a 302 to redirect the browser to
http://localhost:8080/myapp/index.jsp ... which the browser
delightfully does, but upon redirection, the browser doesn't associate
the "username:password" portion with the new URL (possibly due to
security issues). So if your index.jsp is handling the authenticate
protocol, the browser will pop up a diaglog prompting the user for
username/password instead of just logging in as it should.

It's a really esoteric error for most people other than me. But other
issues that arise are that you may want to hide the fact that your
website implementation is a JSP. The way that tomcat currently works
is that since the default url (http://localhost:8080/myapp) is
actually being redirected, your browser won't just show
"http://localhost:8080/myapp/" it will instead show
"http://localhost:8080/myapp/index.jsp" .

Anyway, I did find a solution that works for Tomcat 4.1. I had to
modify the DefaultServlet.java file to allow internal forwarding
rather than redirection--and it works just fine. If you want to see
why I use it, send me an email via my JSP:

http://daiichi:ma**@agentnews.test.xhome.us

Jul 17 '05 #6

P: n/a
DaiIchi wrote:
On Thu, 27 Nov 2003 16:55:18 +0100, Herman Timmermans
<ti********************@skynet.be> wrote:
DaiIchi wrote:
On Mon, 24 Nov 2003 19:38:01 -0000, "PerfectDayToChaseTornados"
<pd***@emailaddress.invalid> wrote:
"DaiIchi" <da*****@agentnews.test.xhome.us> wrote in message
news:62********************************@4ax.co m...
|
| I'm using Tomcat in standalone mode. When a URL without a filename is
| entered into the browser (ie. "http://myhost.mydomain.com"), and the
| default path does NOT have an index.html, but rather an index.jsp
| file, Tomcat response with an "HTTP/1.1 302 Moved Temporarily" and a
| "Location: http://myhost.mydomain.com/index.jsp" ... I was wondering
| if there is a configuration for tomcat that can stop this behavior,
| i.e., just run index.jsp?
|

Yes, you can set up the welcome file using web.xml see the dtd
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd

Thanks, but the issue isn't the welcome file. The problem is that
Tomcat returns a 302 error to force the browser to redirect to the
"real" page. And there is no way in Tomcat 4.1 to turn it off.


I'm surprised, because I use Tomcat 4.1.29 and when I point my browser to
http://localhost:8080/myapp then I will get nicely my index.jsp that I
have
defined in my web.xml settings. No hassle with error 302.
Brgds,
Herman


If myapp is a directory (not a web application), Tomcat will send a
302 Error to redirect your browser to
http://localhost:8080/myapp/index.jsp. This is completely invisible
to the user, so everything looks fine. The problem really occurs if
your JSP handles username/password authentication i.e.
http://username:password@localhost:8080/myapp What happens is that
Tomcat will send a 302 to redirect the browser to
http://localhost:8080/myapp/index.jsp ... which the browser
delightfully does, but upon redirection, the browser doesn't associate
the "username:password" portion with the new URL (possibly due to
security issues). So if your index.jsp is handling the authenticate
protocol, the browser will pop up a diaglog prompting the user for
username/password instead of just logging in as it should.

It's a really esoteric error for most people other than me. But other
issues that arise are that you may want to hide the fact that your
website implementation is a JSP. The way that tomcat currently works
is that since the default url (http://localhost:8080/myapp) is
actually being redirected, your browser won't just show
"http://localhost:8080/myapp/" it will instead show
"http://localhost:8080/myapp/index.jsp" .

Anyway, I did find a solution that works for Tomcat 4.1. I had to
modify the DefaultServlet.java file to allow internal forwarding
rather than redirection--and it works just fine. If you want to see
why I use it, send me an email via my JSP:

http://daiichi:ma**@agentnews.test.xhome.us

OK, I see your point. Thanks for clarifying this - brgds, Herman
--
Suse Linux Professional 8.1 on Athlon 1.1 Ghz 512 Mb
Anti Spam = remove the "dot" and the "at"
Registered Linux User #264690
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.