tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Cannot set remote address in valve (Tomcat 5.5)
Date Fri, 02 Oct 2009 14:29:28 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Elli,

On 10/2/2009 4:41 AM, Elli Albek wrote:
> Yes, the remoteAddress member is protected. So you can only access it if you
> put your class in the same package.
> 
> I thought of doing it like a filter (wrapping) but it does not look like a
> workable solution in this case.

Why not?

> 1. The request class is final (which basically ends the discussion :)

I think you may be looking at the wrong Request class. You want
org.apache.catalina.connector.Request, not org.apache.coyote.Request.
The former is not final. Check the javadoc for the Valve class:

http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/Valve.html

and this enhancement request in bugzilla:

https://issues.apache.org/bugzilla/show_bug.cgi?id=45014

Feel free to use my wrapper classes (with appropriate modifications, of
course).

> 2. This class is not a simple placeholder for values or a wrapper. It is a
> heavy object that is recycled at the end of the request processing and
> contains a lot of code. I don't have any intention to get into Tomcat
> internal resource management and object recycling code.

You don't need to do any of that. Wrapping a request and/or response is
trivial, non-invasive, and you don't have to mess with any Tomcat internals.

> It seems pretty
> complicated. I don't think you can just replace a server object as you can
> do with a servlet request wrapper that is basically a proxy.

Why not?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrGDkgACgkQ9CaO5/Lv0PBE5ACfa+jwGF24WYiQM//BB4aVgfvv
+usAn0njiqTmYnTDF1ldfJr5APJgP9O3
=pw9b
-----END PGP SIGNATURE-----

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


Mime
View raw message