You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark Thomas <ma...@apache.org> on 2010/07/06 18:39:49 UTC

Re: FW: problem with org.apache.catalina.core.ApplicationHttpRequest method.

On 30/06/2010 16:23, Ranjix R wrote:
>
> Hi guys, sorry for the bother. I do have a question related to how a certain feature was implemented in Tomcat (6.0, probably
> all of them), that's why I address the question to the dev-list and the user-list.

Cross-posting to both lists is poor netiquette. That will not have 
encouraged anyone to respond. The correct form, particularly when 
explicitly directed to post to the users list, is to do exactly that. If 
it is decided that a thread has become off-topic for the users list and 
should be on the dev list then it can always be moved there later.

> I do have a fairly complicated case, in which I have a filter for jsp's, and I use a custom request wrapper in the respective filter.
> My request wrapper overrides setAttribute and getAttribute (does some internal management, not relying on the "super"),

Overriding without calling super is asking for trouble unless you are 
sure you are taking care of all the things that the super class is 
handling. As I already told you in the invalid Bugzilla entry you 
created, you should be calling super.getAttribute()

> and I had the surprise to see that the setAttribute from my wrapper doesn't get called from the
> org.apache.catalina.core.ApplicationHttpRequest setAttribute, at least not for the "special attributes" (and I need the
> javax.servlet.include attributes, which Tomcat considers "special").

There is nothing in the spec that says the container has to call 
setAttribute(). The only requirement is that these are made available 
via getAttribute() and they are.

> p.s. the code I believe is at fault is:

Nope. The fault is in your wrapper code.

> 1. do you think is a big issue if I remove the "if" and I just use instead to instructions -
> - setSpecial(name, attribute);
> - getRequest().setAttribute...
> In my tests it seemed to work fine, but maybe I don't grasp all the implications.

No idea. If you want to make a local change, you'll need to do the 
analysis and the testing. I can tell you such a change is highly 
unlikely to make it into the Tomcat source code.

> 2. any particular reason for calling the getRequest().setAttribute only for some (non-special) attributes, but not for others (javax.servlet.include.*)?

At a guess, to prevent applications changing request attributes they 
shouldn't but I haven't checked that is what it is actually doing.

Mark



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