Hello!
This is my first message in the list. I need to do a file upload, in
packages, via http to a server. So, I split the file in 100 packages,
each package represented by a byte[] and converted do base64 to be
posted. So, the file content is being sent in a http post. But for
every post I do (for the whole upload, there is a total of 100 posts)
the server's memory increases a lot, even if I don't process anything
(just by leaving the servlet's doPost method empty). So, in a forum
someone told me to send it multipart. But beacause I'm sending it in
packages, I need to send each byte[] in a multipart way. I don't know
how to do that. I tried this:
private void sendPackage(byte[] pack) throws Exception
{
this.postMethod = new PostMethod(this.host);
Part[] parts =
{
new FilePart("pack", new ByteArrayPartSource("content", pack))
};
this.postMethod.setRequestEntity(new
MultipartRequestEntity(parts, this.postMethod.getParams()));
this.httpClient.executeMethod(this.postMethod);
this.postMethod.releaseConnection();
parts = null;
}
Is this right?? Am I missing something? This method is called a
hundred times in the client.
PS.: In the servlet's side I try to parse the request with the Commons
FileUpload library, but I got errors when the parseRequest method is
called, like internal NullPointerExceptions.
Any suggestions? Thanks a lot for any help...
Vitor Isaia
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]