James Klicman wrote:
>
> Having implemented a RequestDispatcher myself, I also realized the need
> to change the Request URI information during include().
>
> According to the javadocs we aren't violating the spec. The below quote
> is referring (incorrectly I think) to the ServletResponse.
>
> A Quote from RequestDispatcher.include description:
> "The ServletResponse object passed to this servlet has the caller's
> request
> path. The response object only has access to this servlet's
> ServletOutputStream and PrintWriter objects."

There seem to be a typo in the JavaDocs; ServletResponse should be
ServletRequest. This is what's in the spec document (which should
be used before the JavaDoc version in the case of a discrepancy):

  The request object passed to the target object will reflect the
  request URL path and path info of the calling request.

> I think the difference between the two is that the Request object can be
> permanently changed when RequestDispatcher.forward() is called and
> temporarily changed when RequestDispatcher.include() is called.
>
> The URI information needs to be adjusted to include() the resource. Once
> the resource has been includ()ed the Request object must have the
> original Request URI information when continuing.

I'm not sure how you came up with that interpretation, but as far as I
can tell it's a violation of the spec to adjust the URI based information
when you include, even if you put it back afterwards.

The reason for *not* adjusting when including is that the included
servlet/JSP is actually producing a piece of the response for the
original request and therefore need to know about the original request.

With forward, the original servlet decided to hand off the complete
responsibility for the response to another servlet/JSP. The URI based
information is therefore adjusted as if the target was the original
recipient of the request.

See also my other mail about a proposal regarding how to still let an
included servlet/JSP know about the URI used to include it.

--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to