Re: Using POST to send bitmap image with Java
- From: Kevin McMurtrie <mcmurtri@xxxxxxxxxxxxxx>
- Date: Fri, 30 May 2008 23:49:05 -0700
In article <484085f4$0$16920$ec3e2dad@xxxxxxxxxxxxxxxxxxxxxx>,
"Kenneth P. Turvey" <kt-usenet@xxxxxxxxxxxxxxxxxx> wrote:
On Fri, 30 May 2008 20:53:12 +0000, Dave Miller wrote:
Dexter wrote:
In one of my Graphing programs written in Java, I am trying to send a
graphics image (.bmp) to HttpModule on the same server that hosts the
graphing applet.
I found some code on internet that helped me post text data to the
module.
Can someone suggest how I may post the graphics image binary data using
POST method
URL url = new URL("http://www.your-server.com"); HttpURLConnection
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.connect();
DataOutputStream out =
new DataOutputStream(connection.getOutputStream()); // use one of write
methods of out
out.flush();
out.close();
I'm actually in the process of doing this right now. I'm going to be
posting the image to a URL that is a PHP script. When I was looking at
this I thought that this really made more sense to use a PUT method to
post the image, but the guy working on the PHP side insisted on using a
POST method.
Is there a reason that POST would be selected over PUT for this
application? Are there reasons to go with PUT here?
Thanks.
PUT is simple, efficient, and robust for transferring a single file.
POST is inefficient and less robust (stupid MIME format) but it can also
support complex types of data.
The server-side developer has a say in this. POST is easier to use in a
high-level framework. PUT is easier to use in a low-level framework.
--
Block Google's spam and enjoy Usenet again.
Reply with Google and I won't hear from you.
.
- References:
- Using POST to send bitmap image with Java
- From: Dexter
- Re: Using POST to send bitmap image with Java
- From: Dave Miller
- Re: Using POST to send bitmap image with Java
- From: Kenneth P. Turvey
- Using POST to send bitmap image with Java
- Prev by Date: Re: Designing a Card Game
- Next by Date: Re: three public domain java icons
- Previous by thread: Re: Using POST to send bitmap image with Java
- Next by thread: Re: Using POST to send bitmap image with Java
- Index(es):
Relevant Pages
|