Hi

On 16/11/11 12:50, Benson Margulies wrote:
I'm a bit confused by the current content of:

http://cxf.apache.org/docs/jax-rs-multiparts.html

I just wrote the following code:

@POST
     /*
      * Note the bogus content type. Getting jquery/forms to
successfully do Ajax
      * with an upload depends on this.
      */
     @Produces("text/html")
     @Consumes("multipart/form-data")
     @Path("/processText")
     public Response processTextFormToJson(@Multipart(value = "params",
type = "application/json") final PlainTextInputOptions input,

    @Multipart(value = "data", type = "application/octet-stream")
InputStream data) {

where I expect data to be a file upload. The remarks later on state
that I'll need to get into the attachments to make this work, but why?
Only if I need the disposition and other data?

Yes, only for that...

If I just want the file
bytes, should this be good enough?


Should be enough

Also, wikipedia describes the idea of a root part as only for
multipart/related, not multipart/form-data.

I was probably copying/pasting the @Multipart(value = "root"), I guess with multipart/form-data Content-Id is even redundant, with Content-Disposition offering all the info, so if Content-Id is not set then Content-Disposition will be checked to have a relevant attribute. But even when using Content-Disposition only, one can nominate the first part to be "root", if it can convey the 'importance' of this first part somehow ...

Sergey

Cheers, Sergey

Reply via email to