0

I want to create a Resourse using Jax-rs(Jersey implementation) that supports asynchronous file upload. By Asynchronous I mean that I do not want to use the AsyncResponse interface of the Jax-rs. Instead I want when a user starts to upload a file from the client to the server, the server to take the file and start the processing asynchronously and return to the client response 202 Accepted or similar and for instance a URL where the client can monitor the progress of the upload.

I have read the articles about the AsynResponse, the reason why I am not sure in it is because of the resume method. I understand that it executes the heavy load operations in a different IO container but does not do the thing that I want.

The other question is, should I make some modifications to the client because I now use the Apache HTTP Client? It would be perfect if only the server changes :)

  • What is your question? Have you done anything? – JB Nizet Jul 01 '17 at 09:04
  • I want some suggestions how to implement the file upload I have described above. Also, some articles for reading or some code snippets. Thanks – Encho Belezirev Jul 01 '17 at 13:04
  • This is out of the realm of JAX-RS. Just submit a task to an ExecutorService, and return the response you want. Or use your preferred way of executing asynchronous tasks (EJBs and Spring have Async methods, for example). – JB Nizet Jul 01 '17 at 14:26
  • If I do the thing that you suggest then the request-response procedure will complete. In other words, when I submit some operation to be executed asynchronously and return immediately then the request will be transferred to the user and the upload will stop. I have tried that and there were problems when I have to upload a big files. Instead I am searching for a method in the Jax-RS 2.1 that achieve the desired scenario I want. – Encho Belezirev Jul 06 '17 at 06:30
  • Any other suggestions? Thanks – Encho Belezirev Aug 21 '17 at 08:30

0 Answers0