tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chris.kar...@omiris.net
Subject RE: request.getReader() hanging
Date Wed, 05 Jun 2002 10:31:08 GMT
i think i've narrowed the problem down to the ajp13 connector, what's
strange is the connector works fine for all other  /servlet and *.jsp
requests, apart from those where you try to read the request data using
request.getReader()
moreover, performing the same task but making the request directly to tomcat
produces no problems
Code snippets follow:
4660 = apache port
4661 = tomcat port
============================================================================
=
Request Page (sample.html)
<html>
<head>
<script language="javascript">
   function doXml(){
	// Create a requestor and post the request...
	var xmlRequestor = new	ActiveXObject("Microsoft.XMLHTTP");
	xmlRequestor.Open("POST",
"http://localhost:4660/servlet/SampleServlet", false);
	xmlRequestor.SetRequestHeader("Content-type",
"application/x-www-form-urlencoded");
	xmlRequestor.Send("<parent><child>some data</child></parentt>");

	alert(xmlRequestor.responseText);
   }
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
	<script>
		doXml();
	</script>
</body>
</html>
============================================================================
===================================
Sample Servlet

public void doPost(HttpServletRequest request,HttpServletResponse
response)throws ServletException,IOException{
	BufferedReader br = request.getReader();
	String line = null;
	StringBuffer envelope = new StringBuffer();
	while ((line = br.readLine()) != null) {
		envelope.append(line);
	}
	br.close();
	
	PrintWriter out=response.getWriter();
	out.println(envelope+"<returned/>");
}
============================================================================
===================================

If you substitute 4661(tomcat standalone port) for 4660(apache port) in the
request url in the html page, it works fine.

cheers
Chris




-----Original Message-----
From: Rossen Raykov [mailto:Rossen.Raykov@CognicaseUSA.com]
Sent: 03 June 2002 18:08
To: 'Tomcat Users List'
Subject: RE: request.getReader() hanging


Can you reproduce it?
Does it utilize the whole available CPU?

Rossen

> -----Original Message-----
> From: chris.karema@omiris.net [mailto:chris.karema@omiris.net]
> Sent: Friday, May 31, 2002 1:21 PM
> To: tomcat-user@jakarta.apache.org
> Subject: request.getReader() hanging
> 
> 
> hi all
> recently upgraded, or attempted to upgrade, to tomcat 4.0.3, 
> but have hit a
> brick wall.i had a servlet with the following code snippet 
> running perfectly
> fine in 3.2.3 but it's not having any of it with tomcat 4.0.3
> 
>       BufferedReader br = request.getReader();
>       String line = null;
>       StringBuffer envelope = new StringBuffer();
>       while ((line = br.readLine()) != null) {
>         envelope.append(line);
>       }
>       br.close();
> 
> I'm basically sending through a stream of xml data and trying 
> to read it in
> the servlet's post method. What happens is when it gets to 
> the readLine()
> method above, it just hangs forever.
> Trying to read just one character with a simple read() 
> produces the same
> behaviour.
> I've checked the request.content-length and it indicates the 
> data is there.
> No exceptions are thrown or anything. I'm not reading any 
> parameters from
> the request object beforehand either.
> 
> Running Apache 1.3, Tomcat 4.0.3, Solaris 8, with mod_jk
> 
> I've read and adhered to the Servlet API Specification, 
> version 2.2, section
> 5.1, as a previous post about a similar problem suggested, 
> but still no joy
> 
> please help
> cheers
> 
> 
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> postmaster@omiris.net.
> 
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
> **********************************************************************
> 

--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message