Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

HttpServletRequest.getInputStream(), InputStream.read() doesn't work (it blocks) if tomcat uses apache as frontend. Any idea?

bojke

2005-02-15


Hi,

1) I am trying to send some data (content of a file)from an standalone command
line application to the servlet over the (http) stream. It works well.
2) When I am using apache as frontend to the tomcat, servlet blocks.
 It blocks when I try to read input stream:
 

public void doPost(HttpServletRequest request,
  HttpServletResponse response)
  throws ServletException, IOException {
    BufferedReader inputFromClient = null;
    PrintWriter out           = null;
    BufferedWriter impFileWriter  = null;
    // BufferedReader inTest = null;
   
    try {
      // get an input stream from the applet
       inputFromClient = new BufferedReader(new            
InputStreamReader(request.getInputStream()));
       show("Connected");
       
       // writng initialization
       impFileWriter = new BufferedWriter(new FileWriter(importFile));
   
       // read the serialized student data from applet
       show("Importing data...");
       
       String str;

       while ((str = inputFromClient.readLine()) != null) {
         show(str);
         impFileWriter.write(str);
         impFileWriter.flush();
       }

3) InputStreamReader.ready() returns false....

Thoughts?


Thnx, Bojan
 
--
Open WebMail Project (http://openwebmail.org)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.