服务通信主要是Client和Server之间建立网络连接,所有交换的数据都在这个连接里传输,连接可以是按需连接,调用结束后就断掉,也可以是长连接,多个远程过程调用共享同一个连接。不同的RPC框架可能使用不同的网络协议,常用的有直接使用TCP,基于HTTP/HTTP2.0 等,目前pigeon使用的有TCP和HTTP协议。在java领域一些工具和框架已经封装对底层协议的使用进行了封装例如比较著名的Netty(这也是pigeon在使用的通信框架),Apache MINA
A request method is considered “idempotent” if the intended effect onthe server of multiple identical requests with that method is the same as the effect for a single such request. Of the request methods defined by this specification, PUT, DELETE, and safe request methods are idempotent.
The GET method requests transfer of a current selected representatiofor the target resourceGET is the primary mechanism of information retrieval and the focus of almost all performance optimizations. Hence, when people speak of retrieving some identifiable information via HTTP, they are generally referring to making a GET request.
GET方法是向服务器查询,不会对系统产生副作用,具有幂等性(不代表每次请求都是相同的结果)
PUT方法
T he PUT method requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload.
也就是说PUT方法首先判断系统中是否有相关的记录,如果有记录则更新该记录,如果没有则新增记录。
DELETE 方法
The DELETE method requests that the origin server remove the association between the target resource and its current functionality. In effect, this method is similar to the rm command in UNIX: it expresses a deletion operation on the URI mapping of the origin server rather than an expectation that the previously associated information be deleted.
final List<ManagedFilter> filters = this.filters.get(dispatcher); if(filters == null) { next.handleRequest(exchange); } else { final FilterChainImpl filterChain = new FilterChainImpl(exchange, filters, next, allowNonStandardWrappers); filterChain.doFilter(request, response); } }
####组装服务器 1.创建XNIO Workder 2.创建 XNIO SSL实例 3.Create an instance of the relevant Undertow listener class 4.Open a server socket using XNIO and set its accept listener