Return-Path: Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 57416 invoked from network); 14 Nov 2000 16:55:03 -0000 Received: from unknown (HELO vdcrexc1.orange.ch) (212.215.1.70) by locus.apache.org with SMTP; 14 Nov 2000 16:55:03 -0000 Received: by vdcrexc1.orange.ch with Internet Mail Service (5.5.2650.21) id ; Tue, 14 Nov 2000 17:54:35 +0100 Message-ID: <2B26E094BB13D3118FB3006008214FA5F0707E@vdlaexc0.orange.ch> From: Kitching Simon To: "'tomcat-user@jakarta.apache.org'" Subject: RE: Please Look - 3.2 beta 7 problem - RequestDispatcher inclu de() Date: Tue, 14 Nov 2000 17:54:32 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N > -----Original Message----- > From: Wyn Easton [SMTP:wyn_easton@yahoo.com] > Sent: Tuesday, November 14, 2000 2:47 PM > To: tomcat-user@jakarta.apache.org > Subject: RE: Please Look - 3.2 beta 7 problem - RequestDispatcher > inclu de() > > Fair enough. > I did notice the addition of: > > // NOTE: This *must* be done before the include flag is set for > // this request! > response.flushBuffer(); > > in RequestDispatcherImpl.java. That is probably the change that made > my include - forward stop working. > > I guess it is OK by the spec. to do multiple include() method calls? [Kitching Simon] Yes, no problem with this as far as I know. Cheers, Simon > Thanks. > > --- Kitching Simon wrote: > > > > > > > -----Original Message----- > > > From: Wyn Easton [SMTP:wyn_easton@yahoo.com] > > > Sent: Tuesday, November 14, 2000 12:24 PM > > > To: tomcat-user@jakarta.apache.org > > > Subject: Please Look - 3.2 beta 7 problem - RequestDispatcher > > > include() > > > > > > Are you not suppose to mix URL access with a RequestDispatcher? > > > Thanks. > > > > > > Also, in 3.2 beta 6 I could do an include() then a forward(). > > > Now in 3.2 beta 7 I get an illegalState error on the forward() > > > because of an open outputstream. I'm not opening an output stream. > > > The include() must be doing it. > > > > > [Kitching Simon] > > I don't think that it is valid to do include then forward, ie > > if it was possible before, then *that* was the bug, not > > the current behaviour. > > > > To quote from the servlet docs: > > > > forward should be called before the response has been committed > > to the client (before response body output has been flushed). > > If the response already has been committed, this method throws > > an IllegalStateException. > > > > Now I can't find the reference for the moment, but I'm sure that in > > the > > specs somewhere it says that the buffer is *always* flushed before > > an include operation. > > > > Therefore it is not possible, *by definition* to do an include then > > a forward. > > > > > > --- Wyn Easton wrote: > > > > I'm having this problem on 3.2 beta 7 > > > > > > > > The exact text of the exception is: > > > > > > > > java.lang.IllegalArgumentException: Short Read > > > > > > > > This Exception is being generated in HttpUtils.java in the > > > > parsePostData() method. > > > > > > > > Here is what is happening: > > > > > > > > I'm opening a HttpURLConnection to servlet_A that has been set to > > use > > > > the POST method by calling setRequestMethod("POST") for the > > > > HttpURLConnection. In servlet_A I get a ServletInputStream and > > > > read from the HttpURLConnection. > > > > I then get an ServletOutputStream from the response. > > > > I then get a RequestDispatcher for servlet_B. > > > > When I call the include() method I get the exception mentioned > > > > because parsePostData() in HttpUtils tries to read "len" number > > > > of bytes from the ServletInputStream "in" and there is nothing > > > > to read. I changed parsePostData() in HttpUtils to return an > > > > empty Hashtable for this case and it worked fine. > > > > (Maybe this is how this should work since nothing read means no > > > > parameters in the POST data. Even if the len is greater than 0.) > > > > > > > > However, if I try to use the ServletOutputStream after returning > > > > to servlet_A from servlet_B nothing is written to the original > > > > HttpURLConnection. I don't know if the ServletOutputStream is > > > > being closed when I return from the include(). I don't get an > > > > Exception when writing to the ServletOutputStream. I just don't > > > > get any data at the listening end of the HttpURLConnection. > > > > > > > > I'm going to modify my code to use the include() instead of > > > > the HttpURLConnection, but shouldn't it work either way? > > > > > > > > Thanks. > > > > > > > > > > > > ===== > > > > Wyn Easton > > > > wyn_easton@yahoo.com > > > ===== > Wyn Easton > wyn_easton@yahoo.com > > __________________________________________________ > Do You Yahoo!? > Yahoo! Calendar - Get organized for the holidays! > http://calendar.yahoo.com/