Hi On 23/03/12 14:07, Ganesh wrote:
Hi All,The requirements is to post the the form data along with the image/flash file upload via AJAX sumbit. In the server side we used @Consume("multipart/form-data") and the API argument is org.apache.cxf.jaxrs.ext.multipart.MultipartBody When we do a AJAX submit along with file upload everything is working fine. We have a use case to submit the form without file upload. when we do the AJAX sumbit without file upload the request content type is "application/x-www-form-urlencoded" and in the server side we are getting the below exception [org.apache.cxf.jaxrs.utils.JAXRSUtils] .No operation matching request path / is found, HTTP Method : POST, ContentType : application/x-www-form-urlencoded;charset=UTF-8, Accept : application/json,text/javascript,*/*,. 2012-03-22 21:46:27,596 WARN [org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper] WebApplicationException has been caught : no cause is available We tried to add @Consume("application/x-www-form-urlencoded") in the server side, but still we faced the same issue. In one of the thread we found to use org.apache.cxf.jaxrs.ext.RequestHandler to set the content type explicitly in the server side. Could you please tell us whether can we follow the above approach or any other solution to resolve the issue.
You definitely need to have @Consume("application/x-www-form-urlencoded") if the Content-Type is application/x-www-form-urlencoded, however the FormEncodingProvider does not deal with unmarshalling application/x-www-form-urlencoded payloads into MultipartBody.
Thus you need to have two POST handlers, one for dealing with application/x-www-form-urlencoded and having say MultivalueMap parameter, and another (existing) one - for handling multiparts
Cheers, Sergey
Regards, Ganesh -- View this message in context: http://cxf.547215.n5.nabble.com/Ajax-form-submit-for-Maultipart-contetnt-type-along-with-other-form-fields-tp5589560p5589560.html Sent from the cxf-dev mailing list archive at Nabble.com.
-- Sergey Beryozkin Talend Community Coders http://coders.talend.com/ Blog: http://sberyozkin.blogspot.com
