tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ranjix R <>
Subject FW: problem with org.apache.catalina.core.ApplicationHttpRequest method.
Date Wed, 30 Jun 2010 14:23:22 GMT

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
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

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

public  void setAttribute(String name,
    Object value) 
        if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) {
            dispatcherType = value;
        } else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) {
            requestDispatcherPath = value;
        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/

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.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message