tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: [OT] of the different methods to get a user-id
Date Fri, 13 Feb 2009 02:59:40 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 2/12/2009 1:22 PM, Caldarale, Charles R wrote:
> 
> As Pid surmised, it's not Tomcat that is giving you different
> answers.
> Here's Tomcat's implementation of HttpServletRequest.getRemoteUser():
> 
>     public String getRemoteUser() {
>         if (userPrincipal != null) {
>             return (userPrincipal.getName());
>         } else {
>             return (null);
>         }
>     }
> 
> [Aside: Don't know why people think return statements need
> parentheses; maybe they get paid for programming based on the number of
> characters used.]

I don't understand that, either. I suppose this works differently in
different languages, though:

return i++;

return (i++);

I tried in C and Java and got the same result (both return the original
value of i), though I would have expected something different. Not sure
what, though.

What I also don't understand is why userPrincipal is used directly
instead of this.getUserPrincipal, which would allow some measure of
extensibility of the class.

Oh, well.

- -chris

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

iEYEARECAAYFAkmU4hwACgkQ9CaO5/Lv0PB5qACghJ4CDsMAjEuyQ+qDBWc/NwUd
8SEAn284vqUekj//e5wSXD5gUSVvXb4q
=P0xs
-----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