You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Sand <rs...@vgalleries.com> on 2000/08/01 20:04:05 UTC

Re: Not fixed in 3.2.beta2- Bug: Tomcat setting wrong host on redirect

Can anyone else please confirm this bug in 3.2b2??  I'm anxious to see it
fixed in the release of 3.2.  Thaks!

-Richard

-----Original Message-----
From: Richard Sand <rs...@vgalleries.com>
To: tomcat-user@jakarta.apache.org <to...@jakarta.apache.org>
Date: Sunday, July 30, 2000 3:10 AM
Subject: Not fixed in 3.2.beta2- Bug: Tomcat setting wrong host on redirect


>I tried tomcat 3.2-beta 2, it is still putting in the machines local
>hostname into its redirects instead of the FQDN from the request.
>
>Can someone else verify that Tomcat behaves this way?
>
>Thanks!
>
>-Richard
>
>-----Original Message-----
>From: Richard Sand <rs...@vgalleries.com>
>To: tomcat-user@jakarta.apache.org <to...@jakarta.apache.org>
>Date: Sunday, July 30, 2000 12:11 AM
>Subject: Re: Bug: Tomcat setting wrong host on redirect
>
>
>>Exactly!  The FQDN should be pulled from the client's request, because the
>>webserver is unaware of what translation (name, port, etc) is going on
>>between the web server and the client.  I'll try Tomcat 3.2, hopefully it
>>will be a full release soon!
>>
>>Thanks,
>>
>>Richard
>>-----Original Message-----
>>From: Craig R. McClanahan <Cr...@eng.sun.com>
>>To: tomcat-user@jakarta.apache.org <to...@jakarta.apache.org>
>>Date: Saturday, July 29, 2000 8:33 PM
>>Subject: Re: Bug: Tomcat setting wrong host on redirect
>>
>>
>>>
>>>
>>>Richard Sand wrote:
>>>
>>>> Hi- I've switched to another servlet engine to test and confirmed that
>>this
>>>> is a bug in Tomcat.  It should not insert the hostname into the
>redirect.
>>>
>>>Um, have you checked the 2.2 spec?  In Section 6.3, it says:
>>>
>>>    "It is legal to call this method with a relative URL path,
>>>    however the underlying container must translate the
>>>    relative path to a fully qualified URL for transmission back
>>>    to the client."
>>>
>>>>
>>>> If I browse to www.xyz.com:81/servlet/MyServlet and the servlet does a
>>>> response.sendRedirect("/nextpage.html"), the browser should go to
>>>> www.xyz.com:81/nextpage.html, not the internal hostname of the web
>>server.
>>>>
>>>> Any suggestions?  Tomcat is 3.1, web server is Apache on Solaris
>(sparc).
>>>>
>>>
>>>Upgrade to Tomcat 3.2, which grabs the hostname (and port) from the
>>original
>>>request when it creates the absolute URL of the response.
>>>
>>>>
>>>> -Richard
>>>>
>>>
>>>Craig McClanahan
>>>
>>>
>>>>
>>>> -----Original Message-----
>>>> From: Richard Sand <rs...@vgalleries.com>
>>>> To: tomcat-user@jakarta.apache.org <to...@jakarta.apache.org>
>>>> Date: Saturday, July 29, 2000 1:40 AM
>>>> Subject: Tomcat setting wrong host on redirect
>>>>
>>>> >Hi all- whenever I do a respond.sendredirect, Tomcat inserts the
actual
>>>> >hostname of the web server into the redirect, instead of the hostname
>>from
>>>> >the request or the hostname as specified in my Apache httpd.conf.  For
>>>> >example, externally, my server is known as www.xyz.com:81, whereas on
>>the
>>>> >inside it is simply known as "abc".  So on every redirect, the browser
>>is
>>>> >told to go to http://abc/mytarget which it then expands to
>>>> >www.abc.com/mytarget which is, of course, totally wrong!
>>>> >
>>>> >Is there some way to force Tomcat to put the proper host into the
>>redirect?
>>>> >Perhaps some tag in the server.xml that isn't there at the moment?
>>>> Thanks!!
>>>> >
>>>> >-Richard
>>>> >
>>>> >
>>>
>>
>


getResourceAsStream doesn't find files in WEB-INF/classes

Posted by Richard Sand <rs...@vgalleries.com>.
Hi- I've deployed an application with Tomcat at the root (i.e. "/").  At one
point I load a resource file with the command:

InputStream is = getClass().getResourceAsStream("/app.properties");

But Tomcat throws an exception here if the file app.properties is in the
/WEB-INF/classes directory.  If I copy it into a directory that is in the
default CLASSPATH, then it works fine.  Isn't the WEB-INF/classes directory
for each deployed application automatically added to the Tomcat classpath?
Is the behavior I'm seeing the expected behavior?

I hope I'm just doing something thick... otherwise, its more problematic to
be able to bundle up an application, because the resource files would need
to be copied somewhere else.  Any advice?

BTW Tomcat 3.2.2 on Win2k, no web server (i.e. Tomcat default, port 8080).

Thanks!

-Richard