0

I have a large byte file (log file) that I want to upload to server using PUT request. The reason I choose PUT is simply because I can use it to create a new resource or update an existing resource.

My problem is how to handle situation when server or Network disruption happens during PUT request. That is say I have a huge file, during the transfer of which, Network failure happens. When the network resumes, I dont want to start the entire upload. How would I handle this? I am using JAX-RS API with RESTeasy implementation.

brain storm
  • 30,124
  • 69
  • 225
  • 393
  • This basically boils down to: "How resume a PUT to a Servlet after network failure?" HTTP supports `100 continue` for PUT but I am not sure if that can be used with JAX-RS implementations. –  Oct 09 '14 at 16:23

1 Answers1

0

Some people are using the Content-Range Header to achieve this but many people (like Mark Nottingham) state that this is not legal for requests. Please read the comments to this answer.

Besides there is no support from JAX-RS for this scenario.

If you really have the repeating problem of broken PUT requests I would simply let the client slice the files:

PUT /logs/{id}/1
PUT /logs/{id}/2
PUT /logs/{id}/3

GET /logs/{id} would then return the aggregation of all successful submitted slices.

Community
  • 1
  • 1
lefloh
  • 10,653
  • 3
  • 28
  • 50