【发布时间】:2011-10-06 06:06:50
【问题描述】:
我有一个安静的界面,如下所示。 我正在尝试使用 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);
}
当我使用此表格提出要求时
<html>
<body>
<h1>JAX-RS Upload Form</h1>
<form action="/AlbumApplication/rest/createUserphotoDirectory/1/FeedServer" method="post" enctype="multipart/form-data">
<p>
Select a file : <input type="file" name="uploadedFile" size="50" />
</p>
<input type="submit" value="Upload It" />
</form>
</body>
</html>
我收到此错误 - 客户端发送的请求在语法上不正确 (java.lang.RuntimeException: Could find no Content-Disposition header within part).
我忘了写,我在mvc端使用Springmvc,它可能与spring mvc块有关?
【问题讨论】:
-
您能否提供来自服务器的堆栈跟踪或其他错误日志记录?此外,stackoverflow.com/questions/6137444/… 可能是相关的。
-
当我从它提供的 html 页面提交时,它不会进入服务内部(java.lang.RuntimeException:在部分中找不到 Content-Disposition 标头)。这个错误没有堆栈跟踪或日志