Java Async REST web service using Jersey?

前端 未结 2 739
遇见更好的自我
遇见更好的自我 2021-01-05 09:45

I need to implement a Java REST Web Service (we use Jersey framework) which can basically either

a. block waiting for some event (or poll for the event), before retu

相关标签:
2条回答
  • 2021-01-05 10:16

    You might find this interesting: Approach for REST request with long execution time

    0 讨论(0)
  • 2021-01-05 10:26

    Alan, the right thing to do is to use HTTP's 202 Accepted return code and include in the response body a link that points to a page the client can poll to check the status of the request.

    In a machine2machine context you will need to design your media type (or microformat etc.) for those responses so a machine client can 'understand' them.

    See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.3

    Maybe also look at the almost standardized new HTTP Link header for that purpose.

    http://tools.ietf.org/html/draft-nottingham-http-link-header-03

    Jan

    0 讨论(0)
提交回复
热议问题