You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hector Adolfo Alonso <al...@consist.com.ar> on 2001/08/06 23:01:52 UTC

Doubt about getRequestURI() behavior

I have a doubt:
   Suppose you have configured Tomcat server in host "a.b.c" in port "8081".
   Suppose you have set an application with a context named "/" in this server.
   Suppose you have developed a servlet acting as a http proxy, and you have set

a request mapping as "/" for it (you can map "*.jsp" for this servlet too).
   Then, suppose you have configured your web browser using a http proxy at
server "a.b.c" and port "8081".
   When you access any site with this browser, you are using this servlet.
   Here is my doubt. I'm not getting "my" expected reply with getRequestURI().
If I access http://java.sun.com/, the first line in HTTP request generete by the

browser, looks as: GET http://java.sun.com/ HTTP/1.1
   According with Servelet 2.2 API description, this method have to return
information taken for the request first line, buy I'm getting:
http:/java.sun.com/ instead of http://java.sun.com/
   What could be wrong ? I'm using Tomcat 3.2.3, JDK 1.3.1, Win NT 4.0 SP 6a.
   Thanks.

Hector Adolfo Alonso
Consist Teleinformatica



Re: Doubt about getRequestURI() behavior

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 6 Aug 2001, Hector Adolfo Alonso wrote:

> I have a doubt:
>    Suppose you have configured Tomcat server in host "a.b.c" in port "8081".
>    Suppose you have set an application with a context named "/" in this server.
>    Suppose you have developed a servlet acting as a http proxy, and you have set
> 
> a request mapping as "/" for it (you can map "*.jsp" for this servlet too).
>    Then, suppose you have configured your web browser using a http proxy at
> server "a.b.c" and port "8081".
>    When you access any site with this browser, you are using this servlet.
>    Here is my doubt. I'm not getting "my" expected reply with getRequestURI().
> If I access http://java.sun.com/, the first line in HTTP request generete by the
> 
> browser, looks as: GET http://java.sun.com/ HTTP/1.1
>    According with Servelet 2.2 API description, this method have to return
> information taken for the request first line, buy I'm getting:
> http:/java.sun.com/ instead of http://java.sun.com/
>    What could be wrong ? I'm using Tomcat 3.2.3, JDK 1.3.1, Win NT 4.0 SP 6a.
>    Thanks.
> 

IIRC, Tomcat 3.2 doesn't support absolute URLs like this in the HTTP
request line at all.  Tomcat 4.0 does, but only for URLs that resolve to
hosts and webapps inside this Tomcat instance.

Tomcat doesn't implement the complete functionality of a proxy server.
Although it would be an interesting exercise to make this work, I would be
more inclined to use some already-existing proxy server like squid.

> Hector Adolfo Alonso
> Consist Teleinformatica
> 
> 
> 

Craig McClanahan