宁静的图片上传例外

我有一个安静的界面,如下所示。 我正在尝试使用jaxrs接口上传图像,但我遇到了一个错误

@POST @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Path("createUserphotoDirectory/{userid}/{serverName}") @Consumes("multipart/form-data") public String createUserDirectory(@PathParam("userid") Long userid, @PathParam("serverName") String serverName, MultipartFormDataInput input) { System.out.println("1"); photoService.createServerImages(userid,serverName,input); return responseMessageSource.getMessage("SUCCESSFULL_CRATED_ALBUM",null,null); } 

当我要求使用此表格时

   

JAX-RS Upload Form

Select a file :

我收到此错误 – 客户端发送的请求在语法上是不正确的(java.lang.RuntimeException: Could find no Content-Disposition header within part).


我忘了写,我在mvc方面使用Springmvc,它可能属于spring mvc block?

如下所示更改REST服务签名可以解决您的问题

 public String createUserDirectory(@PathParam("userid") Long userid, @PathParam("serverName") String serverName, @FormDataParam("uploadedFile") File file, @FormDataParam("uploadedFile") FormDataContentDisposition disposition) {