I am trying to publish a large video/image file from the local file system to an http path, but I run into an out of memory error after some time...
here is the code
For anything other than basic GET operations, the built-in java.net
HTTP stuff isn't very good. Using Apache Commons HttpClient is recommended for this. It lets you do much more intuitive stuff like this:
PutMethod put = new PutMethod(url);
put.setRequestEntity(new FileRequestEntity(localFile, contentType));
int responseCode = put.executeMethod();
which replaces a lot of your boiler-plate code.