From: Lothar Kimmeringer on 9 Feb 2010 15:29 M�rio wrote: [how to do it] > and it now works: the Date object is sent to the servlet. Good to hear. > But, why is the binary data sent in a subsequent packet? What can be > done to send a single packet for the POST request? The why is hidden in the internals of HttpUrlConnection but I can think of a reason. In general the data being sent by Raw POST is much more than the header. So sending the header then checking if at that point of time the server already sent something back (e.g. a 404) reduces the needed bandwith. Sending megabytes of data just to realize that the server already denied the request at the beginning might get frustrating ;-) Authorative answers can be found by checking the source of the affected classes of the JVM. Regards, Lothar -- Lothar Kimmeringer E-Mail: spamfang(a)kimmeringer.de PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81) Always remember: The answer is forty-two, there can only be wrong questions!
From: Mike Schilling on 10 Feb 2010 01:49 markspace wrote: > M�rio wrote: >> ByteArrayOutputStream data = new ByteArrayOutputStream(); > ... >> Does someone know why this does not generate a POST request? > > Even after correcting the calls as Lothar suggested, I don't see how > this is going to generate a POST request, or that sending binary data > to an HTTP socket is going to be a good idea. There's no problem sending binary data via HTTP, so long as that's what both the client and server expect. For neatness, an appropriate content-type should be set, say, "application/octet-stream".
First
|
Prev
|
Pages: 1 2 Prev: Statements before super() Next: Java Lead with GUI & SWT | CA | 10+ months |