FileUpload with JAX-RS

后端 未结 5 1125
忘了有多久
忘了有多久 2020-11-30 05:08

I try to do file upload from a JavaScript client to a JAX-RS Java server.

I use the following REST upload function on my server:

@POST
@Produces(\'ap         


        
5条回答
  •  我在风中等你
    2020-11-30 05:24

    With pure JAX-RS, assuming you don't need a filename, upload method looks like:

        @POST
        @Consumes(MediaType.MULTIPART_FORM_DATA)
        public void upload(InputStream file, @QueryParam("foo") String foo) {
            // Read file contents from the InputStream and do whatever you need
        }
    

提交回复
热议问题