问题:
解决:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
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; } |
参考:
https://quarkus.pro/guides/rest-client-multipart.html