" No state " Of HTTP
understand HTTP Stateless protocol , Need to understand HTTP Of “ There is no connection ” sex , It's about a request generating a connection , Request processed , Connect and disconnect . So the information communication between client and server is one-time .
Corresponding “ There is a connection ” sex , You can use TCP, Or it specifies Keep-Alive Of HTTP Connect to represent .
because HTTP No connectivity of , The server does not reserve the status information of the client , That is, there is no consistency between the content of a single request and the last request , The client needs to transfer all the information in each request , And the results of the request are not related to each other .
Of course , With session and cookie, Everything is different
The explanations on the Internet are rather vague , There is an in-depth post to refer to : http Protocol stateless " state " What exactly is it ?!
can “ State transition ” Of REST
REST Inside ST(state translate), refer to RE The performance layer represented by , That is to say, it is aimed at all kinds of information about resource status provided URI Speaking of , For state transitions , That's how I understand it :
For the exposed service resources , according to REST My style demands , A set of CRUD Service support of operation method , and CRUD action , It will have a significant impact on the state of the corresponding resources ( except R), So the state here , It's about resources , The result of a request .
Such as , For a student information resource portal /student/{studentId}/ , The submitted CRUD The request will cause the status of the specific student information resource to change to created 、 Obtained ( If there is )、 Updated 、 deleted
therefore , these two items. “ state ”, It doesn't mean the same thing .