简体   繁体   English

JAX-RS:如何返回响应并继续在后端处理请求

[英]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. 我们正在使用Jax-rs(在WebSphere 7上开箱即用:没有其他框架,如CXF或Restfull或Spring)问题:客户端进行http调用,服务器需要3到5分钟来处理请求。 however I do not want to hold the client, I want to return http OK response and then spin off processing call. 但是我不想持有客户端,我想返回http OK响应,然后关闭处理调用。

How to do this in JAX-RS, I am hoping there is some kind of annotations. 如何在JAX-RS中执行此操作,我希望有某种注释。 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). 我没有看到任何其他解决方案,然后启动另一个线程(线程管理比java.util.concurrent之前更容易,所以给它一个机会)。

The other solution is to make AJAX calls to the REST service. 另一种解决方案是对REST服务进行AJAX调用。 AJAX + promises implementation (jQuery promises or more feature rich Q promises library) would make waiting for the service response very easy. AJAX +承诺实现(jQuery承诺或更多功能丰富的Q promises库)将使等待服务响应变得非常容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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