That makes sense. Multipart seems like a pain to implement, so I'm not surprised.
Thanks for the quick response and the nice library. David ----- Original Message ---- From: Roland Weber <[EMAIL PROTECTED]> To: HttpComponents Project <[email protected]> Sent: Friday, December 7, 2007 9:45:18 PM Subject: Re: multipart/form-data in 4.0 Hello David, > I'm having problems figuring out how multipart/form-data entities > are implemented in components 4.0. They're not. > Because UrlEncodedFormEntity exists, I expected an analogue of > MultipartRequestEntity from 3.x. We need URL encoding for query strings anyway, so it's not a big deal to use it in an entity. Formatting multipart entities is a much more complex beast. > If it hasn't been implemented yet, is it on the road map? Not really. For our core activity "HTTP", multipart is somewhat out of scope. We'd love to use multipart code maintained by some other project for which it is in scope, but I'm not aware of any. We tried to move the multipart code to commons-codec a few years ago, but I didn't take off there. Oleg recently mentioned another project that has multipart parsing code and might be interested in our multipart formatting code. I don't know the current status on that. If we should extend our activities to WebDAV, multipart would move into scope. But that is _very_ far at the horizon and may never happen at all. When HttpClient 4.0 goes beta and we have a stable API to work with, I was planning to address the multipart problem somehow. Either as a wrapper from the 4.0 HttpEntity [1] interface to the 3.1 RequestEntity [2] interface, or by moving the multipart code into an unsupported 'contrib' package, or both. The wrapper would of course also be in an unsupported 'contrib' package. For the time being, I recommend to implement a wrapper so you can use 3.1 entities for sending with the 4.0 API. Here's a short run-down on how to map the methods: (sending) getContentLength -> getContentLength getContentType -> getContentType isChunked -> (getContentLenght < 0L) isRepeatable -> isRepeatable writeTo -> writeRequest (receiving, not supported) consumeContent -> UnsupportedOperationException getContentEncoding -> null getContent -> UnsupportedOperationException isStreaming -> false hope this helps, Roland [1] http://jakarta.apache.org/httpcomponents/httpcomponents-core/httpcore/apidocs/org/apache/http/HttpEntity.html [2] http://jakarta.apache.org/httpcomponents/httpclient-3.x/apidocs/org/apache/commons/httpclient/methods/RequestEntity.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
