"Carlos R." wrote:
>
> Hello
>
>  I'm in problems. I'm trying to run a file-upload servlet in a Netscape
> Enterprise server 3.5.1.
> I've probed with the FileUploadServlet that comes with Java web server,
> and with com.oreilly.servlet package but always there are some files
> that
> fail.
>
> I've installed Jrun and the problem persists.
>
> I've some servlets runs, and I think that the problem comes with the
> enctype="multipart/form-data" .
>
> I'm very lose, if somebody has a file-upload servlet runs in Enterprise
> server or somebody knows why can it fail, I'll please you.

I believe all of these file-upload servlets use the ServletInputStream
readLine method, implemented by the base class in the JSDK. In JSDK 2.0
there's a bug in this method (it ignores the len parameter). If you
have access to the source code (you should have the source for the O'Reilly
servlet at least) you can fix this by using your own corrected version
of the method instead, e.g. a slightly modified version of the one in
JSDK 2.1:

    public int readLine(byte[] b, int off, int len, InputStream is)
            throws IOException {

        if (len <= 0) {
            return 0;
        }
        int count = 0, c;

        while ((c = is.read()) != -1) {
            b[off++] = (byte)c;
            count++;
            if (c == '\n' || count == len) {
                break;
            }
        }
        return count > 0 ? count : -1;
    }

Alternatively you could try the file-upload servlet with a servlet
engine that supports the Servlet API 2.1 (i.e. uses the JSDK 2.1
classes). Unfortunately there are not many that do at this point.

--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to