You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Reshat Sabiq <sa...@purdue.edu> on 2003/12/11 08:27:16 UTC

Likely bug in org.apache.jasper.servlet.JspServlet (Tomcat 5)

I think i found a bug in Tomcat 5 implementation (J2EE 1.4-DR). I would 
highly appreciate if somebody could provide a brief description of what 
includeUri, and requestUri below stand for. I looked at the comments in 
Constants, but can't make out a lot out of them. Please see my comment 
below.
org.apache.jasper.servlet.JspServlet.service() starting on line 190:
            String includeUri
                = (String) request.getAttribute(Constants.INC_SERVLET_PATH);
            String requestUri
                = (String) request.getAttribute(Constants.INC_REQUEST_URI);
           
            String jspUri;
           
            // When jsp-property-group/url-matching is used, and when the
            // jsp is not defined with <servlet-name>, the url
            // as to be passed as it is to the JSP container (since
            // Catalina doesn't know anything about the requested JSP
           
            // The first scenario occurs when the jsp is not directly 
under /
            // example: /utf16/foo.jsp
            if (requestUri != null){
                ////////// This is pretty unsafe syntax, and i do get an 
exception here, which is the only reason why i can't migrate my app to 
J2EE 1.4-DR! ///////////
                String currentIncludedUri
                    = 
requestUri.substring(requestUri.indexOf(includeUri));  

                if ( !includeUri.equals(currentIncludedUri) ) {
                    includeUri = currentIncludedUri;
                }
            }

P.S. On a positive note, the custom error pages do work in DR, as 
opposed to Beta 2.

-- 
Sincerely,
Reshat.

-------------------------------------------------------------------------------------------
If you see my certificate with this message, you should be able to send me encrypted e-mail. 
Please consult your e-mail client for details if you would like to do that.


Re: Likely bug in org.apache.jasper.servlet.JspServlet (Tomcat 5)

Posted by Remy Maucherat <re...@apache.org>.
Reshat Sabiq wrote:
> OK. I believe the fmt is a non-issue: el does not consider instance 
> variables in fmt. It probably worked in Beta 2 out of luck 
> (implementation defaulted to default localization attribute name, or 
> something like that). I resolved that.
> The last problem i'm having is that when requesting a folder with a 
> parameter (e.g., /folder?param=value), when index.jsp for that folder is 
> served it does not receive the parameter. This sounds simple, but makes 
> applications unusable. Because of this, my migration to J2EE 1.4-DR is 
> still in progress. It will probably be harder for me to fix this on my 
> own, not knowing Tomcat's architecture and all. Has anybody else come 
> across this?

I find this extremely odd. Welcome file redirection is done by rewriting 
the servlet path, etc. By then, the query string was set aside, and 
should be processed normally.

I think your problem is that an extra redirection will occur:
/folder -> /folder/, and it may not append back the query string. This 
should be a trivial fix in the adapter.
If you do /folder/?param=value I think it will work.

> P.S. In the next couple of days I will be submitting a bug and at least 
> one suggested fix for the 2 issues mentioned above.
> 
> Thanks.
> 



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


Re: Likely bug in org.apache.jasper.servlet.JspServlet (Tomcat 5)

Posted by Reshat Sabiq <sa...@purdue.edu>.

Remy Maucherat wrote:

> Reshat Sabiq wrote:
>
>>
>>
>> Remy Maucherat wrote:
>>
>>> Reshat Sabiq wrote:
>>>
>>>> I think i found a bug in Tomcat 5 implementation (J2EE 1.4-DR). I 
>>>> would highly appreciate if somebody could provide a brief 
>>>> description of what includeUri, and requestUri below stand for. I 
>>>> looked at the comments in Constants, but can't make out a lot out 
>>>> of them. Please see my comment below.
>>>> org.apache.jasper.servlet.JspServlet.service() starting on line 190:
>>>>            String includeUri
>>>>                = (String) 
>>>> request.getAttribute(Constants.INC_SERVLET_PATH);
>>>>            String requestUri
>>>>                = (String) 
>>>> request.getAttribute(Constants.INC_REQUEST_URI);
>>>>                      String jspUri;
>>>>                      // When jsp-property-group/url-matching is 
>>>> used, and when the
>>>>            // jsp is not defined with <servlet-name>, the url
>>>>            // as to be passed as it is to the JSP container (since
>>>>            // Catalina doesn't know anything about the requested JSP
>>>>                      // The first scenario occurs when the jsp is 
>>>> not directly under /
>>>>            // example: /utf16/foo.jsp
>>>>            if (requestUri != null){
>>>>                ////////// This is pretty unsafe syntax, and i do 
>>>> get an exception here, which is the only reason why i can't migrate 
>>>> my app to J2EE 1.4-DR! ///////////
>>>>                String currentIncludedUri
>>>>                    = 
>>>> requestUri.substring(requestUri.indexOf(includeUri));                
>>>> if ( !includeUri.equals(currentIncludedUri) ) {
>>>>                    includeUri = currentIncludedUri;
>>>>                }
>>>>            }
>>>>
>>>> P.S. On a positive note, the custom error pages do work in DR, as 
>>>> opposed to Beta 2.
>>>
>>>
>>>
>>>
>>> This works fine for me. How about telling us what kind of include 
>>> causes your bug, and the exception you get ?
>>>
>>> Rémy
>>>
>> I confirmed that it is a bug. It went further along after i put a 
>> conditional.
>> Now i'm getting an exception in:
>> <fmt:message key="better" bundle="${lc}" />
>> where lc is an instance variable of the jsp servlet: apparently it 
>> can't be resolved. It was working in Beta 2, so this might be a bug too.
>>
>> Thanks.
>>
>> P.S. I'll post the details later.
>
>
> Great: I really don't understand what you're trying to explain, and I 
> don't see how this is related to the include issue mentioned above. So 
> try to make it understandable if you want your bug to live longer than 
> 5 minutes ;-)
>
> BTW, there could be changes between PFD 3 and the final spec.
>
> Rémy
>
OK. I believe the fmt is a non-issue: el does not consider instance 
variables in fmt. It probably worked in Beta 2 out of luck 
(implementation defaulted to default localization attribute name, or 
something like that). I resolved that.
The last problem i'm having is that when requesting a folder with a 
parameter (e.g., /folder?param=value), when index.jsp for that folder is 
served it does not receive the parameter. This sounds simple, but makes 
applications unusable. Because of this, my migration to J2EE 1.4-DR is 
still in progress. It will probably be harder for me to fix this on my 
own, not knowing Tomcat's architecture and all. Has anybody else come 
across this?

P.S. In the next couple of days I will be submitting a bug and at least 
one suggested fix for the 2 issues mentioned above.

Thanks.

-- 
Sincerely,
Reshat.

-------------------------------------------------------------------------------------------
If you see my certificate with this message, you should be able to send me encrypted e-mail. 
Please consult your e-mail client for details if you would like to do that.


Re: Likely bug in org.apache.jasper.servlet.JspServlet (Tomcat 5)

Posted by Remy Maucherat <re...@apache.org>.
Reshat Sabiq wrote:

> 
> 
> Remy Maucherat wrote:
> 
>> Reshat Sabiq wrote:
>>
>>> I think i found a bug in Tomcat 5 implementation (J2EE 1.4-DR). I 
>>> would highly appreciate if somebody could provide a brief description 
>>> of what includeUri, and requestUri below stand for. I looked at the 
>>> comments in Constants, but can't make out a lot out of them. Please 
>>> see my comment below.
>>> org.apache.jasper.servlet.JspServlet.service() starting on line 190:
>>>            String includeUri
>>>                = (String) 
>>> request.getAttribute(Constants.INC_SERVLET_PATH);
>>>            String requestUri
>>>                = (String) 
>>> request.getAttribute(Constants.INC_REQUEST_URI);
>>>                      String jspUri;
>>>                      // When jsp-property-group/url-matching is used, 
>>> and when the
>>>            // jsp is not defined with <servlet-name>, the url
>>>            // as to be passed as it is to the JSP container (since
>>>            // Catalina doesn't know anything about the requested JSP
>>>                      // The first scenario occurs when the jsp is not 
>>> directly under /
>>>            // example: /utf16/foo.jsp
>>>            if (requestUri != null){
>>>                ////////// This is pretty unsafe syntax, and i do get 
>>> an exception here, which is the only reason why i can't migrate my 
>>> app to J2EE 1.4-DR! ///////////
>>>                String currentIncludedUri
>>>                    = 
>>> requestUri.substring(requestUri.indexOf(includeUri));                
>>> if ( !includeUri.equals(currentIncludedUri) ) {
>>>                    includeUri = currentIncludedUri;
>>>                }
>>>            }
>>>
>>> P.S. On a positive note, the custom error pages do work in DR, as 
>>> opposed to Beta 2.
>>
>>
>>
>> This works fine for me. How about telling us what kind of include 
>> causes your bug, and the exception you get ?
>>
>> Rémy
>>
> I confirmed that it is a bug. It went further along after i put a 
> conditional.
> Now i'm getting an exception in:
> <fmt:message key="better" bundle="${lc}" />
> where lc is an instance variable of the jsp servlet: apparently it can't 
> be resolved. It was working in Beta 2, so this might be a bug too.
> 
> Thanks.
> 
> P.S. I'll post the details later.

Great: I really don't understand what you're trying to explain, and I 
don't see how this is related to the include issue mentioned above. So 
try to make it understandable if you want your bug to live longer than 5 
minutes ;-)

BTW, there could be changes between PFD 3 and the final spec.

Rémy



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


Re: Likely bug in org.apache.jasper.servlet.JspServlet (Tomcat 5)

Posted by Reshat Sabiq <sa...@purdue.edu>.

Remy Maucherat wrote:

> Reshat Sabiq wrote:
>
>> I think i found a bug in Tomcat 5 implementation (J2EE 1.4-DR). I 
>> would highly appreciate if somebody could provide a brief description 
>> of what includeUri, and requestUri below stand for. I looked at the 
>> comments in Constants, but can't make out a lot out of them. Please 
>> see my comment below.
>> org.apache.jasper.servlet.JspServlet.service() starting on line 190:
>>            String includeUri
>>                = (String) 
>> request.getAttribute(Constants.INC_SERVLET_PATH);
>>            String requestUri
>>                = (String) 
>> request.getAttribute(Constants.INC_REQUEST_URI);
>>                      String jspUri;
>>                      // When jsp-property-group/url-matching is used, 
>> and when the
>>            // jsp is not defined with <servlet-name>, the url
>>            // as to be passed as it is to the JSP container (since
>>            // Catalina doesn't know anything about the requested JSP
>>                      // The first scenario occurs when the jsp is not 
>> directly under /
>>            // example: /utf16/foo.jsp
>>            if (requestUri != null){
>>                ////////// This is pretty unsafe syntax, and i do get 
>> an exception here, which is the only reason why i can't migrate my 
>> app to J2EE 1.4-DR! ///////////
>>                String currentIncludedUri
>>                    = 
>> requestUri.substring(requestUri.indexOf(includeUri));                
>> if ( !includeUri.equals(currentIncludedUri) ) {
>>                    includeUri = currentIncludedUri;
>>                }
>>            }
>>
>> P.S. On a positive note, the custom error pages do work in DR, as 
>> opposed to Beta 2.
>
>
> This works fine for me. How about telling us what kind of include 
> causes your bug, and the exception you get ?
>
> Rémy
>
I confirmed that it is a bug. It went further along after i put a 
conditional.
Now i'm getting an exception in:
<fmt:message key="better" bundle="${lc}" />
where lc is an instance variable of the jsp servlet: apparently it can't 
be resolved. It was working in Beta 2, so this might be a bug too.

Thanks.

P.S. I'll post the details later.

-- 
Sincerely,
Reshat.

-------------------------------------------------------------------------------------------
If you see my certificate with this message, you should be able to send me encrypted e-mail. 
Please consult your e-mail client for details if you would like to do that.


Re: Likely bug in org.apache.jasper.servlet.JspServlet (Tomcat 5)

Posted by Remy Maucherat <re...@apache.org>.
Reshat Sabiq wrote:
> I think i found a bug in Tomcat 5 implementation (J2EE 1.4-DR). I would 
> highly appreciate if somebody could provide a brief description of what 
> includeUri, and requestUri below stand for. I looked at the comments in 
> Constants, but can't make out a lot out of them. Please see my comment 
> below.
> org.apache.jasper.servlet.JspServlet.service() starting on line 190:
>            String includeUri
>                = (String) request.getAttribute(Constants.INC_SERVLET_PATH);
>            String requestUri
>                = (String) request.getAttribute(Constants.INC_REQUEST_URI);
>                      String jspUri;
>                      // When jsp-property-group/url-matching is used, 
> and when the
>            // jsp is not defined with <servlet-name>, the url
>            // as to be passed as it is to the JSP container (since
>            // Catalina doesn't know anything about the requested JSP
>                      // The first scenario occurs when the jsp is not 
> directly under /
>            // example: /utf16/foo.jsp
>            if (requestUri != null){
>                ////////// This is pretty unsafe syntax, and i do get an 
> exception here, which is the only reason why i can't migrate my app to 
> J2EE 1.4-DR! ///////////
>                String currentIncludedUri
>                    = requestUri.substring(requestUri.indexOf(includeUri)); 
>                if ( !includeUri.equals(currentIncludedUri) ) {
>                    includeUri = currentIncludedUri;
>                }
>            }
> 
> P.S. On a positive note, the custom error pages do work in DR, as 
> opposed to Beta 2.

This works fine for me. How about telling us what kind of include causes 
your bug, and the exception you get ?

Rémy


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