Chunk by chunk large file upload using java rest api

Viewed 1096

I am writing a module in Microservices, where I have to write a rest end point to upload large files chunk by chunk and save each chunk in local tmp directory.. Will get input as chunk of video file.

I am using Java11, Jetty server, SpringBoot framework.

I have written a piece of code in controller as below:

@Named
@Singleton
@Path("/chunk")
public class FileUploadChunkController {

@POST
    @Produces({MediaType.APPLICATION_JSON})
    @Consumes({MediaType.APPLICATION_OCTET_STREAM})
    @Path("/uploadvideo")
    public Response uploadVideo(@FormDataParam("file")InputStream inputStream, @FormDataParam("file") FormDataContentDisposition contentDisposition , @Context final HttpServletRequest request) throws Exception {
        LOGGER.info("Inside method: uploadVideo");

}

When invoking the api with chunk file as data, it is not reaching to the controller POST method.

Could some one help me?

I have spent lot of time but did not get solution for it.

0 Answers
Related