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/04/04 20:01:55 UTC
DO NOT REPLY [Bug 7747] New: -
File Upload Causes Tomcat-Apache to Block
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=7747>.
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=7747
File Upload Causes Tomcat-Apache to Block
Summary: File Upload Causes Tomcat-Apache to Block
Product: Tomcat 4
Version: Nightly Build
Platform: All
OS/Version: Other
Status: NEW
Severity: Major
Priority: Other
Component: Connector:JK/AJP
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: andy.dowling@framework.ie
Hi folks,
I've got the nightly build of apache-tomcat, running as a standalone server and
with the Apache Server (via AJP13).
File uploads are OK with the standalone server, but with AJP13, the first call
to read() on the HttpServletRequest's associated Reader object
(i.e. in order to get the file upload info) will cause the servlet to block.
Note 1: this problem can be replicated on Tomcat 4.0.4 beta 2
Note 2: I couldn't replicate this problem with Tomcat 3.2.1.
Sample code is attached.
Any help would be appreciated!
Cheers,
Andy
--------BEGIN HTML FILE-------
<html>
<head>
<title>Upload File</title>
</head>
<body vlink="red" alink="green" link="blue" bgcolor="white">
<p>Select the file you wish to upload using the "browse" button below, and
click Go!</p>
<form method="POST" enctype="multipart/form-data"
action="http://my_server.com/servlet/ExampleFileUpload">
<center>
<input type="FILE" name="upload"/><br/>
<input type="SUBMIT" value="Go!"/><br/>
</center>
</form>
</html>
--------END HTML FILE--------
--------BEGIN SERVLET SOURCE-------
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class ExampleFileUpload extends HttpServlet
{
public void doPost (HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException
{
if (!request.getContentType().startsWith("multipart/form-data"))
throw new ServletException ("Expecting multipart/form-data");
//
// Now let's read the file upload
//
BufferedReader in = new BufferedReader(request.getReader());
//---------------------
//- START HERE!
//---------------------
System.err.println ("About to make the first call to readLine()...");
String boundary = in.readLine();
System.err.println ("Got the MIME boundary line: |" + boundary + "|");
//---------------------
//- END HERE!
//---------------------
//
// Any remaining code won't execute due to the blocking call...
//
}
}
--------END SERVLET SOURCE--------
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>