MIME multipart updates #72

Merged
merged 5 commits into from Apr 17, 2012

Projects

None yet

2 participants

@dlvenable
Contributor

I made a change to support Couch's MIME multipart/related PUT operation. This allows for pushing a document along with its attachments relatively efficiently.

More information on this Couch API is available:
http://wiki.apache.org/couchdb/HTTP_Document_API#Multiple_Attachments

dlvenable added some commits Apr 12, 2012
@dlvenable dlvenable Added the updateMultipart method to the CouchDbConnector to support C…
…ouch's MIME multipart/related PUT operation.
3fbddd9
@dlvenable dlvenable Support a null boundary by leaving off the boundary part of the Conte…
…nt-Type. So the resulting Content-Type will simply be "multipart/related".
fb5d2b1
@helun
Owner
helun commented Apr 14, 2012

Ok, cool.

If boundary is nullable, I think there should be a updateMultipart method without the boundary argument as well.

Some documentation on this feature would not hurt. could you write a multipart section under Chapter 7. Attachments:
https://github.com/helun/Ektorp/blob/master/doc/src/docbkx/reference_doc.xml

@dlvenable
Contributor

I added the new overload without boundary. The updateMultipart with a boundary still accepts null. Should it require it non-null since there is an overload?

I also updated the reference documentation.

@helun
Owner
helun commented Apr 17, 2012

good,

one question though, what is the use case for updating a document without a boundary, i.e. just the doc? why not use one of the ordinary update methods in that case?

if there's no real use case for it, maybe we should remove the overloaded method and make boundary a required argument.

what do you think?

@dlvenable
Contributor

The particular use case is that I need to update the document 1) as a stream and 2) with Options. I think that a new update method could handle this rather than the null boundary.

void updateAsStream(String id, InputStream document, long documentLength, Options options);

Would you prefer that method? If so, I can try that and make the necessary changes.

@helun
Owner
helun commented Apr 17, 2012

ok, I see.

call it just void update(String id, InputStream document, long documentLength, Options options)

@dlvenable dlvenable Removed the updateMultipart overload which did not take a boundary. T…
…o provide similar functionality created a new update method which takes an InputStream containing a JSON document.
296dd40
@dlvenable
Contributor

I added the new update method. I also created a new section in the reference documentation under "Update" in chapter 5. I do prefer this method over the updateMultipart.

To clarify on the use-case, this allows us to update documents straight from JSON documents without having to parse the document. This is very helpful for some very large documents that we have.

@helun helun merged commit df74621 into helun:master Apr 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment