472,796 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 software developers and data experts.

Tomcat configuration question


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
6 12042

"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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steve Adams | last post by:
Hi, I have a JSP application on Tomcat that performs XSL transformations on an XML file using the xtags-1.0 taglib. Basically, I have an 'edit' page that displays a table of entities from my XML...
0
by: Kevin Sagon | last post by:
I am running a J2EE Web App under Tomcat 4.1 with Apache 2.0 proxying requests. Everything is configured and working appropriately however I ran into a problem after configuring J2EE Form...
5
by: Tom Martin | last post by:
I'm a Java Web developer NEWBIE that has inherited a website that fails every 2 hours due to poor connection pooling between Tomcat 4.0.6 and mySQL. In efforts to resolve this problem, I've...
4
by: Subhodini Fernandes | last post by:
A very basic question about Tomcat 3.3.1 configuration - We have an application setup on Tomcat. Daily the service needs to be taken down for backup purpose for 1 hour and we need Tomcat to...
0
by: Monica Ferrero | last post by:
Hi! I'm not sure if this is the most adequate mySQL list for this post. If not, please indicat me which one I should use... I'm using Tomcat 4.1.24 with Apache 2 and MySQL 4.0.13. I have the...
4
by: Edward V. Berard | last post by:
People, I am having problems developing Java applications on a Mac using Eclipse, MyEclipse, and Tomcat 5.5+. My current configuration: Mac OS X (10.4.5) Eclipse (3.1+) MyEclipse (4.0+)
0
ak1dnar
by: ak1dnar | last post by:
Hi Guys, I am using a virtual private server which runs Linux OS in it. On the server Apache and Tomcat has installed and to the best of my knowledge mod_jk also installed and working perfectly. In...
0
by: Arun21084 | last post by:
Hi, Recently I installed an application HP SIP(Service Information Portal) on a Windows 2000 server.The application comes along with an installation of Tomcat 5.0.19. Already there was an Apache...
0
rsrinivasan
by: rsrinivasan | last post by:
Hi all, I already posted the same question in this forum. But i did not get any solution for this. I am using tomcat4.1. This is my tomcat context configuration in server.xml file. ...
0
by: amie2008 | last post by:
Hi Folks, I need urgent help with tomcat-apache configuration for load balancing using the mod_proxy module. I have been trying to achieve this configuration: 2 tomcat instances load balanced...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.