?

Log in

No account? Create an account
December 17th, 2008 - LiveJournal Development [entries|archive|friends|userinfo]
LiveJournal Development

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

December 17th, 2008

FotoBilder and HttpComponents 4 (with MultipartEntity) [Dec. 17th, 2008|09:56 pm]
LiveJournal Development

lj_dev

[captainspam]
[Tags|, , ]
[mood |confusedconfused]

At one point, I wired together a somewhat simple FotoBilder client that I never announced on lj_dev. Oops. Long story short, it was written in Java, it used the Apache HttpComponents 3.x libraries, and it used multipart-MIME when it came to preparing images for upload and doing the actual uploading itself. And all was well. Relatively simple, but well. HttpComponents 3.x worked perfectly.

Then along comes HttpComponents 4.x, and they yoinked the multipart-MIME support from it, apparently. Instead, they tie into, I believe, HttpMime's MultipartEntity. And honestly, that shouldn't be much of a problem, either, as it seems fairly simple to use in-code. And, as a matter of fact, it DOES work, right up to the point where I give it any sort of binary data via an InputStreamBody.

At that point, for some reason, FotoBilder throws a 201 error back at me, "Invalid request: Couldn't parse upload". Now, as far as I can tell, I have everything set up right, and any multipart message to FotoBilder WITHOUT binary data is working, and the server isn't throwing a protocol-level error at me (that is, it's definitely FotoBilder complaining that it can't parse my upload, not Apache claiming I'm violating protocol), so I'm a bit stumped. Does anyone have experience using HttpComponents 4.x in Java and knows how MultipartEntity issues its data? Anything I'm missing, or is it something in FotoBilder?

Oh, and yes, I do somewhat need to switch to HttpComponents 4.x for a project I'm recycling this code into, so staying behind isn't an option.

Alternatively, is the XML FotoBilder interface made yet? Might be simpler. :-)

Behind the cut is the code in question...

The code in questionCollapse )
link8 comments|post comment

navigation
[ viewing | December 17th, 2008 ]
[ go | Previous Day|Next Day ]