Quarkus JAX-RS 上传文件 问题: 解决: public final static class Form1 { @PartType(MediaType.APPLICATION_OCTET_STREAM) @FormParam("file") public InputStream f; } @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public ArticleAttachment upload(@QueryParam("articleId") int articleId, @MultipartForm Form1 form1) throws IOException { System.out.println("articleId:" + articleId); final byte[] d = form1.f.readAllBytes(); System.out.println("f:" + d.length); final File file = new File("a.jpg"); System.out.println("file:" + file.getAbsolutePath()); IOUtils.write(d, new FileOutputStream(file)); return null; } 1234567891011121314151617 public final static class Form1 { @PartType(MediaType.APPLICATION_OCTET_STREAM) @FormParam("file") public InputStream f; } @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public ArticleAttachment upload(@QueryParam("articleId") int articleId, @MultipartForm Form1 form1) throws IOException { System.out.println("articleId:" + articleId); final byte[] d = form1.f.readAllBytes(); System.out.println("f:" + d.length); final File file = new File("a.jpg"); System.out.println("file:" + file.getAbsolutePath()); IOUtils.write(d, new FileOutputStream(file)); return null; } … Read More