You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/03/27 07:00:24 UTC

DO NOT REPLY [Bug 7506] New: - Reading Inputstream returned in the following senarior quick fails under TC4.0.3 but work under 3.3a

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7506>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7506

Reading Inputstream returned in the following senarior quick fails under TC4.0.3 but work under 3.3a

           Summary: Reading Inputstream returned in the following senarior
                    quick fails under TC4.0.3 but work under 3.3a
           Product: Tomcat 4
           Version: 4.0.3 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: nmaynard@neomation.com
                CC: nmaynard@neomation.com


This JSP page:
<%@ page import="java.net.*,java.io.*"
	buffer="none" 
	errorPage="" 
	isErrorPage="false"
	language="java"
	session="false"
	contentType="text/html;charset=ISO-8859-1"
%>

<%//@ include file="" %>
<%//@ taglib uri="" prefix=""%>

<%! //Page Declarations (member variables and functions)
%>

Hi.... calling ProcessorServlet.....

<% HttpURLConnection Processor = (HttpURLConnection)(new URL
( "http://localhost/playground/ProcessorServlet" ) ).openConnection();
Processor.setRequestMethod( "POST" );
Processor.setDoOutput( true );
Processor.setDoInput( true );

	String messageToSend = new String( "sent to ProcessorServlet" );

	OutputStreamWriter Out = new OutputStreamWriter( 
Processor.getOutputStream() );
	
	Out.write( messageToSend );
	Out.flush();
	Out.close();


	BufferedReader br = new BufferedReader( new InputStreamReader(  
Processor.getInputStream() ) );

	String line = null;

	while ( (line = br.readLine()) != null){
		out.println("line: " + line);
	}
	
%>

talking to this Servlet code:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class ProcessorServlet extends HttpServlet
{

	private static final int bufferSize = 512;

public void doPost(HttpServletRequest req,
                   HttpServletResponse resp) 
           throws ServletException, IOException
{
		ServletInputStream in = req.getInputStream();

		byte[] b = new byte[100]; 
  
		while( in.read(b) > 0) {
			System.out.write(b);
			System.out.flush(); 
		} 
	}

}

fails to produce any ouput to System.out under tomcat4.0.3, but works fine 
under tomcat3.3a. And I can verify that the JSP page is producing data in the 
body of the HTTP1.1 request, and it does work as anticipated under 3.3a.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>