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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.