@Path("/upload/")
@POST
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
@Produces(MediaType.APPLICATION_JSON)
public Response uploadAttachment(@QueryParam("fileName") String fileName
) {}我正在从表单数据发送文件在post。here is image file format。但无法将此文件检索到此方法中。谁能帮帮我。
发布于 2021-03-26 00:42:23
您必须使用@FormDataParam,而不是@QueryParam。所以它看起来像这样:
@Path("/upload/")
@POST
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
@Produces(MediaType.APPLICATION_JSON)
public Response uploadAttachment(@FormDataParam("fileName") String fileName) {}文档:http://javadox.com/org.glassfish.jersey.media/jersey-media-multipart/2.17/org/glassfish/jersey/media/multipart/FormDataParam.html
https://stackoverflow.com/questions/66784943
复制相似问题