tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: Make the InetAddress object available via ServletRequest?
Date Sun, 09 Oct 2011 16:43:29 GMT
On 09/10/2011 15:57, Francis Galiegue wrote:
> Hello,
> 
> I have my CIDR matching valve/filter ready (still struggling to write
> unit tests, but it works in real-world situations), and there is
> something I find quite unoptimized: you have getRemoteHost() and
> getRemoteAddr() to get the remote host name and IP addresses as
> strings, but why can't you get hold of the InetAddress object
> directly?

Because Tomcat implements the Servlet specification and the
specification does not provide such a method. We can't add such a method
since any change to the public API of the Servlet spec would trigger a
TCK failure.

> It would be much faster to do so... In my valve and filter, I have to
> .getRemoteAddr() and create an InetAddress object out of the string...

How much faster? What performance penalty are we talking about here?
When making any argument based on performance, you really need to
provide some hard numbers to put the problem into context.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message