我有一个带有Netty的jersy 2.13的服务器应用程序,我尝试上传一个带有"multipart/form-data"的文件,我收到了这个错误.
错误消息:
7605 10:01:49.309 [child-group-3-1] org.jvnet.mimepull.MIMEParsingException: Missing start boundary
66242 08:57:42.713 [child-group-3-1] ERROR ROOT - No codec available to display error for 'Content-Type:multipart/form-data; boundary=----webkitformboundaryv4kegleyi4tkjp8j'
Run Code Online (Sandbox Code Playgroud)
我的依赖
compile group: "org.glassfish.jersey.core", name: "jersey-server", version: "2.13"
compile group: "org.glassfish.jersey.media", name: "jersey-media-json-jackson", version: "2.13"
compile group: "org.glassfish.jersey.media", name: "jersey-media-multipart", version: "2.13"
Run Code Online (Sandbox Code Playgroud)
我的资源:
@POST
@Path("/upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void uploadFile(@FormDataParam("file") InputStream stream, @FormDataParam("file") FormDataContentDisposition contentDispositionHeader)
{
System.out.println("Enter uploadFile");
String outputPath = "C:/upload/";
java.nio.file.Path outPath = FileSystems.getDefault().getPath(outputPath, contentDispositionHeader.getFileName());
try
{
Files.copy(stream, outPath);
}
catch (IOException e)
{ …Run Code Online (Sandbox Code Playgroud)