In c# I'm able to do this:
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
request.Method = "POST";
request.ContentType = "application/octet-stream";
request.ContentLength = fileToSend.Length;
request.Timeout = 2000000000;
using (Stream requestStream = request.GetRequestStream())
{
// Send the file as body request.
requestStream.Write(fileToSend, 0, fileToSend.Length);
requestStream.Close();
}
I'm looking for a similar object I can use in Java to take the role of HttpWebRequest, that will include a Stream.
Thanks!
edit: found this Using java.net.URLConnection to fire and handle HTTP requests but it seems much too complicated... Hopefully there is a simpler way of doing this?