Statelessness Provide credentials with the request. Each request MUST stand alone and should not be affected from previous conversation happened from same client in past.
The server never relies on information from previous requests.
Statelessness
As per the REST (REpresentational “State” Transfer) architecture, the server does not store any state about the client session on the server side. This restriction is called Statelessness. 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 therefore kept entirely on the client. client is responsible for storing and handling all application state related information on client side.
It also means that client is responsible for sending any state information to server whenever it is needed. There should not be anysession affinity or sticky sessions on server.
To enable clients to access these stateless APIs, its necessary that servers also should include every piece of information that client may need to create state on it’s side.
For becoming stateless, do not store even authentication/authorization details of client. Provide credentials with the request. Each request MUST stand alone and should not be affected from previous conversation happened from same client in past.
Application State vs Resource State
Please do not confuse between application state and resource state. Both are completely different things.
Application state is server-side data which servers store to identify incoming client requests, their previous interaction details and current context information.
Resource state is the current state of a resource on server at any point of time – and it has nothing to do with interaction between client and server. It is what you get as response from server as API response. You refer to it as resource representation.
REST statelessness means being free on application state.
Advantages of Statelessness
There are some very noticeable advantages for having REST APIs stateless.
- Statelessness helps in scaling the APIs to millions of concurrent users by deploying it to multiple servers. Any server can handle any request because there is no session related dependency.
 - Being stateless makes REST APIs less complex – by removing all server side state synchronization logic.
 - A stateless API is also easy to cache as well. A specific software can decide whether or not to cache the result of an HTTP request just by looking at that one request. There’s no nagging uncertainty that state from a previous request might affect the cacheability of this one. It improves the performance of applications.
 - The server never loses track of “where” each client is in the application, because the client sends all necessary information with each request.
 
Reference: Roy T. Fielding on Stateless
Statelessness Provide credentials with the request. Each request MUST stand alone and should not be affected from previous conversation happened from same client in past.的更多相关文章
- String path = request.getContextPath();     String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";作用!!!!!
		
<%String path = request.getContextPath();String basePath = request.getScheme()+"://"+re ...
 - C#中 Request, Request.params , Request.querystring , Request.Form 区别 与联系用法
		
C#中 Request, Request.params , Request.querystring , Request.Form 区别 与联系用法? Request.params , Request ...
 - basePath = request.getScheme()+"://"+request.getServerName()+":"+r
		
basePath = request.getScheme()+"://"+request.getServerName()+":"+r (2014-06-30 1 ...
 - String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+pat----------<base>元素有关
		
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request. ...
 - request.get request.GET……
		
发现他们是不同的. 报错: AttributeError at /add/ 'WSGIRequest' object has no attribute 'get' Request Method: GE ...
 - 客户端的数据来源:QueryString, Form, Cookie  Request[]与Request.Params[]
		
在ASP.NET编程中,有三个比较常见的来自于客户端的数据来源:QueryString, Form, Cookie . 我们可以在HttpRequest中访问这三大对象. QueryString: 获 ...
 - JSP之项目路径问题(${pageContext.request.contextPath},<%=request.getContextPath()%>以及绝对路径获取)
		
本随笔这是作为一个记录使用,以备后查.项目完成之后本地部署OK,本地Linux部署OK,都可以正常的访问,可是当我把它部署到服务器上面的时候,首页可以正常访问,可是当发出请求的时候却报错误了,说找不到 ...
 - 安卓开发笔记(十六):'Request(okhttp3.Request.Builder)' has private access in 'okhttp3.Request
		
当出现了'Request(okhttp3.Request.Builder)' has private access in 'okhttp3.Request的错误的时候,实际上是我们在写代码的时候少打了 ...
 - <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %>
		
<%String path = request.getContextPath();String basePath = request.getScheme()+"://"+re ...
 
随机推荐
- eclipse逆向生成实体类
			
(转自:http://blog.csdn.net/wangpeng047/article/details/6877720) 做项目必然要先进行数据库表设计,然后根据数据库设计建立实体类(VO),这是理 ...
 - 【bzoj1109】[POI2007]堆积木Klo  动态规划+树状数组
			
题目描述 Mary在她的生日礼物中有一些积木.那些积木都是相同大小的立方体.每个积木上面都有一个数.Mary用他的所有积木垒了一个高塔.妈妈告诉Mary游戏的目的是建一个塔,使得最多的积木在正确的位置 ...
 - HDU——2647Reward(DFS或差分约束)
			
Reward Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
 - BZOJ 1813 [Cqoi2017]小Q的棋盘 ——树形DP
			
唔,貌似以前做过这样差不多的题目. 用$f(i,0/1)$表示从某一点出发,只能走子树的情况下回到根.不回到根的最多经过不同的点数. 然后就可以DP辣 #include <map> #in ...
 - P2389 电脑班的裁员 (动态规划)
			
题目背景 隔壁的新初一电脑班刚考过一场试,又到了BlingBling的裁员时间,老师把这项工作交给了ZZY来进行.而ZZY最近忙着刷题,就把这重要的任务交(tui)给了你. 题目描述 ZZY有独特的裁 ...
 - mysql解压之后的安装
			
远程连接报错(error:10061)看这篇:https://www.cnblogs.com/zipon/p/5877820.html 从5.6.20之后root会自动生成一个随机密码在/root/. ...
 - Linux(11):期中架构(3)--- SSH远程管理服务 & ansible 批量管理服务
			
SSH远程管理服务 1. 远程管理服务知识介绍 # 1.1 SSH远程登录服务介绍说明 SSH是Secure Shell Protocol的简写,由 IETF 网络工作小组(Network Worki ...
 - 标准C程序设计七---04
			
Linux应用 编程深入 语言编程 标准C程序设计七---经典C11程序设计 以下内容为阅读: <标准C程序设计>(第7版) 作者 ...
 - msp430项目编程34
			
msp430中项目---flash编程34 1.电路工作原理 2.代码(显示部分) 3.代码(功能实现) 4.项目总结
 - set_include_path() &&get_include_path()用法
			
function initialize(){ set_include_path(get_include_path().PATH_SEPARATOR . "core/"); ...