You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by 박성수 <ss...@thinkfree.com> on 2001/04/25 07:25:54 UTC

[bug report] servlet's twice calling

os : unix & windows 2000
servlet container : tomcat 3.2.1 release

For the two implementations presented below, requests submitted from the file fileupload.html call up fileUpload2.jsp twice.

The file fileUpload2.jsp is called only once when fileupload.html submits a request on other serlet engines(servlet containers).

Apparently this is a tomcat bug. The results are identical for UNIX and Windows 2000 systems.

☞ fileupload.html

<form action="/examples/fileUpload2.jsp"
 method=post enctype=multipart/form-data>
<input type=file size=50 name="upload">
<input type=reset value="cancel"><br>
<input type=submit value="file transmit">


☞ fileUpload2.jsp

<%@ page contentType="text/html; charset=euc-kr" 
  errorPage="error.jsp"
  import="java.io.*"
  language="java" 
%>

<%

 boolean checkFileSize = true;

 int fileSize = request.getContentLength();
 System.out.println("contentLength : " + fileSize);
 out.println("contentLength : " + fileSize + "<br>");

 // limited file size (5MB)
 if ( fileSize > 1024*1024*5 ) {
    System.out.println("Large file size");
  checkFileSize = false;
  out.println("<script language=JavaScript>");
        out.println("alert(\"too large file. retry again...\");");
        out.println("history.back();");
        out.println("</script>");
        out.flush();
    }
 
 if ( checkFileSize ) {
  System.out.println("Small file size");
  out.println("run file upload");
 }
 System.out.println("end....");
 
%>




Re: [bug report] servlet's twice calling

Posted by David Wall <dw...@myEastside.com>.
Well, I'm using 3.2.2beta, but we do file uploads and don't see double
postings at all.  It would seem like a serious problem, though, to have
double POST calls done since that would result in two transactions.

I have seen the opposite, though, when serving up a file that was uploaded,
I've noted that there are two GET requests done.  It seems like some
browsers, perhaps, are doing an initial get (to get the last modified
date?), then close the request and do another to actually retrieve the file.
But it's not consistent, and I suspect it's a browser thing...

David