你的位置:首页 > 软件开发 > ASP.net > The Open Web Interface for .NET (OWIN) 源码阅读

The Open Web Interface for .NET (OWIN) 源码阅读

发布时间:2016-03-20 01:00:14
katana开源许久,网上仍未搜索到对其源码的阅读总结,本人在工作中正好遇到数据处理流程框架设计,想来跟服务器处理request和response差不多,遂起了阅读katana源码,并借鉴其设计的想法,磕磕碰碰,困难重重,所幸有一些收获,与大家交流交流。katana源码 http ...

katana开源许久,网上仍未搜索到对其源码的阅读总结,本人在工作中正好遇到数据处理流程框架设计,想来跟服务器处理request和response差不多,遂起了阅读katana源码,并借鉴其设计的想法,磕磕碰碰,困难重重,所幸有一些收获,与大家交流交流。

katana源码 https://katanaproject.codeplex.com/

oget='_blank'>win官网 http://owin.org/

两个最重要的数据结构

1 Environment

IDictionary<string, object>

官方解释:

This data structure is responsible for storing all of the state necessary for processing an HTTP request and response, as well as any relevant server state. An OWIN-compatible Web server is responsible for populating the environment dictionary with data such as the body streams and header collections for an HTTP request and response. It is then the responsibility of the application or framework components to populate or update the dictionary with additional values and write to the response body stream.

Environment是在pipeline中流动的数据,代表着一个具体的request和response,后文会介绍在每个pipeline stage中会对这个dictionary中自己关心的数据进行处理,并在进入下一个stage的时候丢弃引用,采用的是原子操作,因而每个Environment只存在一个pipeline stage中。数据举例:

Key Name

Value Description

"owin.RequestBody"

A Stream with the request body, if any. Stream.Null MAY be used as a placeholder if there is no request body. See Request Body.

"owin.RequestHeaders"

An IDictionary<string, string[]> of request headers. See Headers.

"owin.RequestMethod"

A string containing the HTTP request method of the request (e.g., "GET", "POST").

"owin.RequestPath"

A string containing the request path. The path MUST be relative to the "root" of the application delegate; see Paths.

"owin.RequestPathBase"

A string containing the portion of the request path corresponding to the "root" of the application delegate; see Paths.

"owin.RequestProtocol"

A string containing the protocol name and version (e.g. "HTTP/1.0" or "HTTP/1.1").

"owin.RequestQueryString"

A string containing the query string component of the HTTP request URI, without the leading “?” (e.g., "foo=bar&baz=quux"). The value may be an empty string.

"owin.RequestScheme"

A string containing the URI scheme used for the request (e.g., "http", "https"); see URI Scheme.


 

海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com

原标题:The Open Web Interface for .NET (OWIN) 源码阅读

关键词:.NET

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。