简体   繁体   中英

JAX-RS : How to return a response and continue processing the request in the back end

we are using Jax-rs (out of box on WebSphere 7 : no other frameworks like CXF or Restfull or Spring) question: Client makes a http call, the server takes 3 to 5 minutes to process the request. however I do not want to hold the client, I want to return http OK response and then spin off processing call.

How to do this in JAX-RS, I am hoping there is some kind of annotations. I really do not want to get into spinning off a thread and managing it (no complex solutions with threading).

Thanks for your help

I don't see any other solution then starting another thread (thread management is easier then it was before java.util.concurrent, so give it a chance).

The other solution is to make AJAX calls to the REST service. AJAX + promises implementation (jQuery promises or more feature rich Q promises library) would make waiting for the service response very easy.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM