Using Jackson to parse multipart/form-data or application/json

I am using CXF with JacksonJsonProvider for my REST Services. I have a test method as follows @POST @Path("/book/{id}") @Consumes({"application/json, multipart/form-data, application/x-www-urlencoded"}) @Produces({"application/json"}) public boolean setOwner(Book book) { System.out.println(book.getName()); return true; } Now if I make a POST request with a raw JSON string as follows {"Book":{"name":"Book name","publisher":"Book publisher"}} The request is processed correctly as I use Content-Type as 'application/json' while making the request. But since I am integrating with an external service, I recieve either multipart/form-data OR application/x-www-urlencoded for which there is nothing afaik in Jackson that can handle it. If someone can point me to the right direction that would be great. I can manage multipart/form-data with Jettison (part of CXF) but I would like to use Jackson.

以上就是Using Jackson to parse multipart/form-data or application/json的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准