Hi

First of all try to use the same annotation on both parameters, @Multipart. As far as I recall, having @Form on parameters mapped to a multipart payload works only if parameters are primitives such as String.

I'm assuming StatusUpdateType can not be read. This is because when reading the multiparts it is the job of MessageBodyReader to convert InputStream representing that parameter into something like StatusUpdateType.

The default conversion mechanism from String to a custom type does not apply in this case because we do not know if InputStream can be meaningfully read into String.

So register a custom MBR that can convert InputStream into StatusUpdateType and set @Multipart on the parameter and it should work

HTH, Sergey

On 27/08/15 22:40, kanu.emeka wrote:
Hello Sergey,

I am using cxf version 2.7.0.redhat-610379, as part of fabric and camel, and
have followed a similar path, configuring the @Multipart to my json type. I
also have an attachment as well in the request, but I get the same problem.
Is there something wrong with version 2.7.0?

ResourceClass{

.....
@POST
@Path("/stat/{statId}/status")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public Response createStatus(@Multipart(value="upload", required = false)
Attachment upload, @FormParam(value = "update")StatusUpdateType
statusUpdate){
return null;
}



--
View this message in context: 
http://cxf.547215.n5.nabble.com/JAX-RS-form-reading-I-m-stumped-tp567915p5760543.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to