Hi
On 29/05/12 15:50, Christian Lipp wrote:
Hello!
From the documentation (see
http://cxf.apache.org/docs/jax-rs-multiparts.html#JAX-RSMultiparts-MultipartannotationandOptionalattachments)someone
should receive a 400 status if a multipart is missing.
However I receive a 500 status. I looked into the source and think that in the
class
org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils
function
getMultipart()
throws a
throw new WebApplicationException(
new MultipartReadException(id.value(), id.type(),
errorMsg.toString()));
which results in a 500 status code.
Used version is
<cxfversion>2.6.0</cxfversion>
Is the documentation right or the code? I would like to give a 400er back to
the client. In that case I should mark all parameters as not required and than
check against null and return 400 if any parameter is null. Or do you think
500er is just fine?
400 is better, it's thrown in a couple of places, but in the code which
you pointed too, it's a quick fix, so I've committed it just now
Workaround: register a custom WebApplicationException mapper and react
to MultipartReadException as needed...
Thanks, Sergey
Kind regards,
Christian LIPP
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com