I do not think that this is a JServ bug.


I'm not a servlet ace, but if you read the API spec for BufferedReader.read() it says 
that it blocks until a character is ready to be read.  I'd guess that there is no 
input available for your stream to read so it is patiently following the spec and 
blocking until one becomes available.   Use in.ready() to determine if read() will 
block or not.

e.g.,


if ( in.ready() )
  out.println( "input is: " + in.read() );
else
   out.println( "nothing to read" );

But unless you have something that sends "binary data in the body of the request" 
(quoted from the ServletRequest.getInputReader() method description) I'm not sure it 
makes sense to use this particular construct.  I think this would require you to at 
least use a doPost and send your form data via a POST, but now I'm really beyond what 
I know.  Get parameters are better fetched with methods like getParameter etc.

just a thought.

Tyler


P.S.  All of this I obtained by reading the Java I/O API and doing a few quick tests.  
Need to understand how the calls/objects you are making work before just jumping in 
and using them (but hey, we all get excited and jump in from time to time :-).


>following servlet hangs my JServ 1.1 :
>
>import java.io.*;
>import java.util.*;
>import javax.servlet.*;
>import javax.servlet.http.*;
>
>public class Bad extends HttpServlet
>{
>    public void doGet (HttpServletRequest request,
>                       HttpServletResponse response)
>        throws ServletException, IOException
>        {
>            PrintWriter out;
>            response.setContentType("text/plain");
>            out = response.getWriter();
>        try {
>        ServletInputStream sis = request.getInputStream();
>        InputStreamReader isr = new InputStreamReader(sis);
>        Reader in = new BufferedReader(isr);
>        in.read();
>        } catch (Exception ex)
>{out.println(ex.getMessage());ex.printStackTrace(out);}
>        }
>}
>
>I have tried it in two enviroments:
>
>Apache 1.3.9/JServ1.1/IBM JDK1.1.8/RedHat Linux 6.1
>Apache 1.3.9/JServ1.1/SUN JDK1.2.2/Sparc SunOS 5.7
>
>It worked in JServ1.0
>Martin
>
>
>--
>----------------------------------------------------------
>To subscribe:        [EMAIL PROTECTED]
>To unsubscribe:      [EMAIL PROTECTED]
>Archives and Other:  <http://java.apache.org/main/mail.html>
>Problems?:           [EMAIL PROTECTED]


------------------------------------------------------
Tyler Morrison - [EMAIL PROTECTED]


--
----------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to