hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ossf...@dubioso.net>
Subject Re: multipart/form-data in 4.0
Date Sat, 08 Dec 2007 04:45:18 GMT
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: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message