Reputation: 8215
Normally I would consider any system that changes its behaviour over time as stateful.
Now let's consider a REST service. You GET a resource, later you or someone else modifies the resource with PUT and then you GET the resource again. Obviously, according to the above definition, this would be a stateful system.
But in the context of web services it would still be considered as stateles. So the definition of state must be different here.
What I think is actually meant by stateless webservices, is that the result of a given request should be the same for each client at a given time.
Is that correct? And why does it differ from my usual definition of state? Is stateless the same as connectionless here?
Upvotes: 1
Views: 83
Reputation: 57257
The reference you are looking for is Architectural Styles and the Design of Network-based Software Architectures, by Roy Fielding. Specifically, chapter three, where he enumerates a number of architectural styles, in particular client-stateless-server.
The client-stateless-server style derives from client-server with the additional constraint that no session state is allowed on the server component. Each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is kept entirely on the client.
Edit:
So is it correct to say that state in this context does not refer to the state of the server but to the state of a (non-existing) session? Or in other terms, that stateless is a synonym for sessionless here?
Yes.
Upvotes: 3