Java Client cancelling thread in REST

2019-09-22 08:23发布

问题:

I wanted to cancel the REST thread triggered from client, however as REST should be stateless, how can this be achieved?

回答1:

If you want to cancel the request on the server side, just return a response. In case you want to kill the thread that is currently doing REST request, just kill the thread.

REST is stateless means that the web server does not store any state about the client application/session state. The session is stored on the client. The server is stateless means that every server can service any client at any time, there is no session affinity or sticky sessions. The relevant session information is stored on the client and passed to the server as needed.