tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bergsten <>
Subject Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11
Date Tue, 02 Dec 2003 20:16:35 GMT
Remy Maucherat wrote:
> [...]
> Now the big question is actually what the new getLocalPort call should 
> return. If you need an extra localPort (and its friend getLocalName - 
> did you notice the getLocalName() call was always returning whatever 
> hostname was in the host header) field in the request because it doesn't 
> correspond to vhosting (I consider it would be yet another major blunder 
> of the Servlet spec, but what can I do ...), then so be it.

The getLocalXXX() methods are intended to provide information about
where the request was _recieved_ by the container, rather than where
it was _sent_ by the client, which is useful information for some types
of applications, for instance to detect if there's any vhosting

So you have three sets of methods for getting address/port info.
* Where the request was received (server socket):

* Where the request was sent (Host header info):

* Where the request comes from (client socket):

With an HTTP/1.1 request with a Host header "" value, proxied
through Apache to Tomcat listening on port 8005, from a client (or a
proxy) at ( port 1766, the methods should return
these values:

     getLocalName() -> localhost (or some other local interface)
     getLocalPort() -> 8005
     getLocalAddr() -> (or some other local interface)

     getServerName() ->
     getServerPort() -> 80

     getRemoteName() ->
     getRemotePort() -> 1766
     getRemoteAddr() ->

Without proxying through Apache, a Host header "localhost:8080"
value and Tomcat listening on port 8080, it would look like this

     getLocalName() -> localhost
     getLocalPort() -> 8080
     getLocalAddr() ->

     getServerName() -> localhost
     getServerPort() -> 8080

     getRemoteName() ->
     getRemotePort() -> 1766
     getRemoteAddr() ->

Hans Bergsten                                <>
Gefion Software                       <>
Author of O'Reilly's "JavaServer Pages", covering JSP 2.0 and JSTL 1.1
Details at                                    <>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message