On 30/06/2010 15:23, Ranjix R wrote:

Cross posting to both lists isn't usually a good idea.

p

> 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. 
> 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"), 
> 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"). 
> 
> The code that I find is problematic is copied underneath (the if(!setSpecial) 
> part), and the question is "why doesn't the 
> getRequest.setAttribute get called ALL THE TIME". The problem manifests when 
> I do a jsp:include, and when the
> filter on the included jsp checks my wrapper, can't find the 
> javax.servlet.include.* attributes. This is somewhat bothering, 
> considering that I don't have this issue with Weblogic and Websphere, both do 
> call my wrapper's set/getAttribute... 
> 
> p.s. the code I believe is at fault is:
> 
> org.apache.catalina.core.ApplicationHttpRequest
> ...
> public  void setAttribute(String name,
>     Object value) 
> {
>         if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) {
>             dispatcherType = value;
>             return;
>         } else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) {
>             requestDispatcherPath = value;
>             return;
>         }
>         if (!setSpecial(name, value)) {
>             getRequest().setAttribute(name, value);
>         }
> }So, the questions are: 
> 
> 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. 
> 
> 2. any particular reason for calling the getRequest().setAttribute only for 
> some (non-special) attributes, but not for others (javax.servlet.include.*)? 
> 
> thanks for any suggestion/
> ranjix 
> 
> 
> 
>                                         
> Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox. 
> Learn more.                                        
> _________________________________________________________________
> Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to