You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by BugRat Mail System <to...@cortexity.com> on 2001/01/15 21:17:46 UTC

BugRat Report #771 has been filed.

Bug report #771 has just been filed.

You can view the report at the following URL:

   <http://znutar.cortexity.com/BugRatViewer/ShowReport/771>

REPORT #771 Details.

Project: Tomcat
Category: Bug Report
SubCategory: New Bug Report
Class: swbug
State: received
Priority: medium
Severity: critical
Confidence: public
Environment: 
   Release: 3.2.1
   JVM Release: JDK1.3
   Operating System: Win2k
   OS Release: Pro
   Platform: Intel

Synopsis: 
RequestDispatcher.forward() broken with custom ServletRequest implementations

Description:
When chaining services via RequestDispatcher.forward(ServletRequest req, ServletResponse res), there is no way to modify the data in req.  For instance, if I wished to perform alterations on the request data and create my own implementation of ServletRequest. I cannot then use an instance of my implementation this with RequestDispatcher.forward() because the first thing it attempts to do is cast the ServletRequest to org.apache.tomcat.facade.HttpServletRequestFacade. This makes for some rather tame and incomplete chaining.

Re: BugRat Report #771 has been filed.

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
BugRat Mail System wrote:
> 
> Bug report #771 has just been filed.
> 
> You can view the report at the following URL:
> 
>    <http://znutar.cortexity.com/BugRatViewer/ShowReport/771>
> 
> REPORT #771 Details.
> 
> Project: Tomcat
> Category: Bug Report
> SubCategory: New Bug Report
> Class: swbug
> State: received
> Priority: medium
> Severity: critical
> Confidence: public
> Environment:
>    Release: 3.2.1
>    JVM Release: JDK1.3
>    Operating System: Win2k
>    OS Release: Pro
>    Platform: Intel
> 
> Synopsis:
> RequestDispatcher.forward() broken with custom ServletRequest implementations
> 
> Description:
> When chaining services via RequestDispatcher.forward(ServletRequest req, ServletResponse res), there is no way to modify the data in req.  For instance, if I wished to perform alterations on the request data and create my own implementation of ServletRequest. I cannot then use an instance of my implementation this with RequestDispatcher.forward() because the first thing it attempts to do is cast the ServletRequest to org.apache.tomcat.facade.HttpServletRequestFacade. This makes for some rather tame and incomplete chaining.

That's how it should be according to the Servlet 2.2 spec; you're only
allowed to pass on the request/response you received when you use the
RD to invoke another servlet.

However, Servlet 2.3 relaxes this and allows you to do what you want.
I suggest you take a look at the Proposed Final Draft, available at
Sun's Servlet site: <http://java.sun.com/products/servlet/>. Tomcat 4.0
implements this proposal.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com