hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Walsh" <daniel.wals...@verizon.net>
Subject MultipartPostMethod Holding File Stream Open?
Date Wed, 26 Feb 2003 01:05:49 GMT
I'm using a MultipartPostMethod to upload a file to a servlet:

File file = new File(strUrl);

HttpClient client = new HttpClient();
HostConfiguration hostConfig = new HostConfiguration();
MultipartPostMethod mpPost = new MultipartPostMethod();
 hostConfig.setHost(someURL.getHost(), someURL.getPort(), someURL.getProtocol());

mpPost.addParameter("someName", "someValue");
mpPost.addParameter(file.getName(), file);


String confirmUpload = tpPost.getResponseBodyAsString();

file.delete();  // this is being blocked.

After the upload, I would like to delete the file off of my disk.  Using other methods of
uploading the file (in particular a PutMethod), I was able to then delete the file after the
upload.  Now that I am using the MultipartPostMethod obj for the upload, I am unable to delete
the file (the return value is false, and there is no SecurityException being thrown - no SecurityManager
even set as of this point either).

So, I guess my question is whether there is a call to the MultipartPostMethod obj that I'm
overlooking that would release it's connection (I'm sure that it is opening an InputStream
of some sort to read the file contents, in order to form the HTTP message) to the file - so
that I can then have unimpeded access to it for other operations?

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