- 浏览: 2682971 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
80后的童年2:
深入浅出MongoDB应用实战开发网盘地址:https://p ...
MongoDB入门教程 -
shliujing:
楼主在不是精通java和php的前提下,请不要妄下结论。
PHP、CakePHP哪凉快哪呆着去 -
安静听歌:
希望可以一给一点点注释
MySQL存储过程之代码块、条件控制、迭代 -
qq287767957:
PHP是全宇宙最强的语言!
PHP、CakePHP哪凉快哪呆着去 -
rryymmoK:
深入浅出MongoDB应用实战开发百度网盘下载:链接:http ...
MongoDB入门教程
Request
Request = Request-Line
*(( general-header
| request-header
| entity-header ) CRLF)
CRLF
[ message-body ]
Request-Line
Request-Line = Method SP Request-URI SP HTTP-Version CRLF
An example Request-Line would be:
GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
The Method token indicates the method to be performed on the resource identified by the Request-URI
The method is case-sensitive
Method = "OPTIONS"
| "GET"
| "HEAD"
| "POST"
| "PUT"
| "DELETE"
| "TRACE"
| "CONNECT"
| extension-method
extension-method = token
The methods GET and HEAD MUST be supported by all general-purpose servers. All other methods are OPTIONAL
An origin server SHOULD return the status code 405 (Method Not Allowed) if the method is known by the origin server but not allowed for the requested resource, and 501 (Not Implemented) if the method is unrecognized or not implemented by the origin server
Request-URI = "*" | absoluteURI | abs_path | authority
The asterisk "*" means that the request does not apply to a particular resource, but to the server itself, and is only allowed when the method used does not necessarily apply to a resource
The Resource Identified by a Request
The exact resource identified by an Internet request is determined by examining both the Request-URI and the Host header field
1. If Request-URI is an absoluteURI, the host is part of the Request-URI. Any Host header field value in the request MUST be ignored.
2. If the Request-URI is not an absoluteURI, and the request includes a Host header field, the host is determined by the Host header field value.
3. If the host as determined by rule 1 or 2 is not a valid host on the server, the response MUST be a 400 (Bad Request) error message.
Request Header Fields
request-header = Accept
| Accept-Charset
| Accept-Encoding
| Accept-Language
| Authorization
| Expect
| From
| Host
| If-Match
| If-Modified-Since
| If-None-Match
| If-Range
| If-Unmodified-Since
| Max-Forwards
| Proxy-Authorization
| Range
| Referer
| TE
| User-Agent
| Range
| Referer
| TE
| User-Agent
New or experimental header fields MAY be given the semantics of request- header fields if all parties in the communication recognize them to be request-header fields
Unrecognized header fields are treated as entity-header fields
Response
Response = Status-Line
*(( general-header
| response-header
| entity-header ) CRLF)
CRLF
[ message-body ]
Status-Line
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
The first digit of the Status-Code defines the class of response
There are 5 values for the first digit:
- 1xx: Informational - Request received, continuing process
- 2xx: Success - The action was successfully received,
understood, and accepted
- 3xx: Redirection - Further action must be taken in order to
complete the request
- 4xx: Client Error - The request contains bad syntax or cannot
be fulfilled
- 5xx: Server Error - The server failed to fulfill an apparently
valid request
Status-Code =
"100" ; Continue
| "101" ; Switching Protocols
| "200" ; OK
| "201" ; Created
| "202" ; Accepted
| "203" ; Non-Authoritative Information
| "204" ; No Content
| "205" ; Reset Content
| "206" ; Partial Content
| "300" ; Multiple Choices
| "301" ; Moved Permanently
| "302" ; Found
| "303" ; See Other
| "304" ; Not Modified
| "305" ; Use Proxy
| "307" ; Temporary Redirect
| "400" ; Bad Request
| "401" ; Unauthorized
| "402" ; Payment Required
| "403" ; Forbidden
| "404" ; Not Found
| "405" ; Method Not Allowed
| "406" ; Not Acceptable
| "407" ; Proxy Authentication Required
| "408" ; Request Time-out
| "409" ; Conflict
| "410" ; Gone
| "411" ; Length Required
| "412" ; Precondition Failed
| "413" ; Request Entity Too Large
| "414" ; Request-URI Too Large
| "415" ; Unsupported Media Type
| "416" ; Requested range not satisfiable
| "417" ; Expectation Failed
| "500" ; Internal Server Error
| "501" ; Not Implemented
| "502" ; Bad Gateway
| "503" ; Service Unavailable
| "504" ; Gateway Time-out
| "505" ; HTTP Version not supported
| extension-code
extension-code = 3DIGIT
Reason-Phrase = *<TEXT, excluding CR, LF>
pplications MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class, with the exception that an unrecognized response MUST NOT be cached
Response Header Fields
response-header = Accept-Ranges
| Age
| ETag
| Location
| Proxy-Authenticate
| Retry-After
| Server
| Vary
| WWW-Authenticate
Entity
Request and Response messages MAY transfer an entity if not otherwise restricted by the request method or response status code
An entity consists of entity-header fields and an entity-body, although some responses will only include the entity-headers
Entity Header Fields
Entity-header fields define metainformation about the entity-body or, if no body is present, about the resource identified by the request
entity-header = Allow
| Content-Encoding
| Content-Language
| Content-Length
| Content-Location
| Content-MD5
| Content-Range
| Content-Type
| Expires
| Last-Modified
| extension-header
extension-header = message-header
Entity Body
The entity-body (if any) sent with an HTTP request or response is in a format and encoding defined by the entity-header fields
entity-body = *OCTET
An entity-body is only present in a message when a message-body is present
When an entity-body is included with a message, the data type of that body is determined via the header fields Content-Type and Content- Encoding
These define a two-layer, ordered encoding model:
entity-body := Content-Encoding( Content-Type( data ) )
Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body
If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource
If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream"
The entity-length of a message is the length of the message-body before any transfer-codings have been applied
Examples
Request = Request-Line
*(( general-header
| request-header
| entity-header ) CRLF)
CRLF
[ message-body ]
Request-Line
Request-Line = Method SP Request-URI SP HTTP-Version CRLF
An example Request-Line would be:
GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
The Method token indicates the method to be performed on the resource identified by the Request-URI
The method is case-sensitive
Method = "OPTIONS"
| "GET"
| "HEAD"
| "POST"
| "PUT"
| "DELETE"
| "TRACE"
| "CONNECT"
| extension-method
extension-method = token
The methods GET and HEAD MUST be supported by all general-purpose servers. All other methods are OPTIONAL
An origin server SHOULD return the status code 405 (Method Not Allowed) if the method is known by the origin server but not allowed for the requested resource, and 501 (Not Implemented) if the method is unrecognized or not implemented by the origin server
Request-URI = "*" | absoluteURI | abs_path | authority
The asterisk "*" means that the request does not apply to a particular resource, but to the server itself, and is only allowed when the method used does not necessarily apply to a resource
The Resource Identified by a Request
The exact resource identified by an Internet request is determined by examining both the Request-URI and the Host header field
1. If Request-URI is an absoluteURI, the host is part of the Request-URI. Any Host header field value in the request MUST be ignored.
2. If the Request-URI is not an absoluteURI, and the request includes a Host header field, the host is determined by the Host header field value.
3. If the host as determined by rule 1 or 2 is not a valid host on the server, the response MUST be a 400 (Bad Request) error message.
Request Header Fields
request-header = Accept
| Accept-Charset
| Accept-Encoding
| Accept-Language
| Authorization
| Expect
| From
| Host
| If-Match
| If-Modified-Since
| If-None-Match
| If-Range
| If-Unmodified-Since
| Max-Forwards
| Proxy-Authorization
| Range
| Referer
| TE
| User-Agent
| Range
| Referer
| TE
| User-Agent
New or experimental header fields MAY be given the semantics of request- header fields if all parties in the communication recognize them to be request-header fields
Unrecognized header fields are treated as entity-header fields
Response
Response = Status-Line
*(( general-header
| response-header
| entity-header ) CRLF)
CRLF
[ message-body ]
Status-Line
Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
The first digit of the Status-Code defines the class of response
There are 5 values for the first digit:
- 1xx: Informational - Request received, continuing process
- 2xx: Success - The action was successfully received,
understood, and accepted
- 3xx: Redirection - Further action must be taken in order to
complete the request
- 4xx: Client Error - The request contains bad syntax or cannot
be fulfilled
- 5xx: Server Error - The server failed to fulfill an apparently
valid request
Status-Code =
"100" ; Continue
| "101" ; Switching Protocols
| "200" ; OK
| "201" ; Created
| "202" ; Accepted
| "203" ; Non-Authoritative Information
| "204" ; No Content
| "205" ; Reset Content
| "206" ; Partial Content
| "300" ; Multiple Choices
| "301" ; Moved Permanently
| "302" ; Found
| "303" ; See Other
| "304" ; Not Modified
| "305" ; Use Proxy
| "307" ; Temporary Redirect
| "400" ; Bad Request
| "401" ; Unauthorized
| "402" ; Payment Required
| "403" ; Forbidden
| "404" ; Not Found
| "405" ; Method Not Allowed
| "406" ; Not Acceptable
| "407" ; Proxy Authentication Required
| "408" ; Request Time-out
| "409" ; Conflict
| "410" ; Gone
| "411" ; Length Required
| "412" ; Precondition Failed
| "413" ; Request Entity Too Large
| "414" ; Request-URI Too Large
| "415" ; Unsupported Media Type
| "416" ; Requested range not satisfiable
| "417" ; Expectation Failed
| "500" ; Internal Server Error
| "501" ; Not Implemented
| "502" ; Bad Gateway
| "503" ; Service Unavailable
| "504" ; Gateway Time-out
| "505" ; HTTP Version not supported
| extension-code
extension-code = 3DIGIT
Reason-Phrase = *<TEXT, excluding CR, LF>
pplications MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class, with the exception that an unrecognized response MUST NOT be cached
Response Header Fields
response-header = Accept-Ranges
| Age
| ETag
| Location
| Proxy-Authenticate
| Retry-After
| Server
| Vary
| WWW-Authenticate
Entity
Request and Response messages MAY transfer an entity if not otherwise restricted by the request method or response status code
An entity consists of entity-header fields and an entity-body, although some responses will only include the entity-headers
Entity Header Fields
Entity-header fields define metainformation about the entity-body or, if no body is present, about the resource identified by the request
entity-header = Allow
| Content-Encoding
| Content-Language
| Content-Length
| Content-Location
| Content-MD5
| Content-Range
| Content-Type
| Expires
| Last-Modified
| extension-header
extension-header = message-header
Entity Body
The entity-body (if any) sent with an HTTP request or response is in a format and encoding defined by the entity-header fields
entity-body = *OCTET
An entity-body is only present in a message when a message-body is present
When an entity-body is included with a message, the data type of that body is determined via the header fields Content-Type and Content- Encoding
These define a two-layer, ordered encoding model:
entity-body := Content-Encoding( Content-Type( data ) )
Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body
If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource
If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream"
The entity-length of a message is the length of the message-body before any transfer-codings have been applied
Examples
D:\projects\maui>curl -I www.g.cn HTTP/1.1 301 Moved Permanently Location: http://www.google.cn/webhp?source=g_cn Content-Type: text/html; charset=UTF-8 Date: Fri, 26 Dec 2008 05:07:21 GMT Expires: Sun, 25 Jan 2009 05:07:20 GMT Cache-Control: public, max-age=2592000 Server: gws Content-Length: 0 D:\projects\maui>curl -I www.google.cn HTTP/1.1 200 OK Cache-Control: private, max-age=0 Date: Fri, 26 Dec 2008 05:07:28 GMT Expires: -1 Content-Type: text/html; charset=GB2312 Set-Cookie: PREF=ID=fc9dd9293e07dfbd:NW=1:TM=1230268048:LM=1230268048:S=GSJ0ovAC pSDvYdtq; expires=Sun, 26-Dec-2010 05:07:28 GMT; path=/; domain=.google.cn Server: gws Content-Length: 0 D:\projects\maui>curl -I 192.168.0.5 HTTP/1.1 302 Found Content-Type: text/html; charset=utf-8 Set-Cookie: _freewheel_session_id=6f190d42bf361e23336c7b646a565c2d; path=/; Http Only Location: http://192.168.0.5/system/account/login Cache-Control: no-cache Content-Length: 105 Date: Fri, 26 Dec 2008 05:27:16 GMT Server: lighttpd/1.4.19
发表评论
-
leveldb资料整理
2011-12-28 19:50 10845leveldb介绍 http://code.google.co ... -
HTTP Basic/Digest Authentication、OAuth
2009-01-09 14:01 9617HTTP Authentication au ... -
HTTP1.1 Notes 8, Header Field Definitions
2008-12-31 13:13 4452http://www.w3.org/Protocols/rfc ... -
HTTP1.1 Notes 7, Status Code Definitions
2008-12-30 15:01 3304Informational 1xx This class of ... -
HTTP1.1 Notes 6, Method Definitions
2008-12-30 12:30 2507Safe and Idempotent Methods In ... -
HTTP1.1 Notes 5, Connections
2008-12-29 13:25 2733Persistent Connections advantag ... -
HTTP1.1 Notes 3, HTTP Message
2008-12-26 10:57 4217Message Types HTTP-mess ... -
HTTP1.1 Notes 2, Protocol Parameters
2008-12-24 13:12 2716HTTP Version HTTP-Versio ... -
HTTP1.1 Notes 1, Terminology & ABNF
2008-12-23 17:03 2838http://www.w3.org/Protocols/rfc ... -
以后都用MindManager做年度总结和年度计划
2008-12-19 19:54 60212008总结如下: 2009计划如下: 希望自己能够戒骄 ... -
Skip List 跳表
2008-12-19 15:54 5557跳表是个概率性的的数据结构,由William Pugh在199 ... -
数据仓库toolkit笔记1,Dimensional Modeling Primer
2008-12-15 18:49 2429数据仓库管理员的主要职责: 1,通过业务领域、工作职责和计算机 ... -
CLRS笔记15,动态规划
2008-12-10 18:14 1888动态规划算法的实质是分治思想和解决冗余,因此,动态规划是一种将 ... -
Web搜索引擎原理和技术
2008-12-08 12:06 4861主要的三个功能模块: ... -
CLRS笔记12,二叉查找树/红黑树
2008-12-04 17:32 2829二叉查找树 二叉查找树是一颗二叉树,并且每个节点x的左子树中所 ... -
CLRS笔记11,Hash Table
2008-12-03 15:02 2021Hash Table是实现动态集合在O(1)时间内的INSER ... -
CLRS笔记10、基本数据结构
2008-11-28 14:28 1911数学中的集合是不变的 ... -
CLRS笔记8,线性时间排序(counting、radix、bucket sort)
2008-11-27 11:13 3497线性时间排序即时间复杂度为Θ(n)的排序,主要有计数排序、基数 ... -
How to be Computer Game Developer?
2008-07-21 13:35 1269http://www.beyondrails.com/blog ... -
游戏引擎剖析
2008-07-21 11:59 2405转载一篇《游戏引擎剖析》系列,了解游戏引擎开发相关的知识。 ...
相关推荐
你可以从http://info.internet.isi.edu/7c/in-notes/rfc/.cache找到下面提到的所有这些RFC规范。 RFC1738统一资源定位器(URL) RFC1808相关统一资源定位器 RFC1945超文本传输协议--HTTP/1.0 RFC2045多用途Internet...
public ResponseEntity createUser(@RequestBody User user) { // 创建用户并返回响应 } } ``` 4. **访问Swagger UI**:启动项目后,可以通过浏览器访问`http://localhost:8080/swagger-ui.html`来查看和测试生成...
public ResponseEntity createUser(@RequestBody @ApiParam("User details") User user) { // 方法实现 } } ``` 上述例子中,`@Api`注解描述了整个`UserController`,而`@ApiOperation`和`@ApiParam`则分别...
public ResponseEntity<String> createUser(@RequestBody @Valid User user) { // 创建用户的逻辑... return ResponseEntity.ok("用户创建成功"); } } ``` 当上述代码配置完成后,运行SpringBoot应用,然后访问...
- `ResponseEntity[][]>>`: 表示响应实体的类型,包含了封装好的数据和HTTP状态码。 - `PersonalResource[][]>`: 一个自定义的数据结构,用来封装返回的数据。 - `String[][]`: 二维字符串数组,代表一周七天每天十...
public ResponseEntity<User> createUser(@RequestBody User user) { // 实现业务逻辑 } } ``` `@ApiOperation`注解用于描述接口的主要功能,`@ApiParam`、`@ApiModel`、`@ApiModelProperty`等注解可以帮助我们...
public ResponseEntity createUser(@RequestBody User user) { ... } ``` 5. `@ApiModel` 和 `@ApiModelProperty`:用于定义数据模型及其属性。`@ApiModel` 标记一个类,描述整个模型,而 `@ApiModelProperty` ...
public ResponseEntity<User> createUser(@RequestBody @Valid User user) { // 接口实现代码 } } ``` 4. **运行和访问Swagger UI** 完成以上步骤后,启动SpringBoot应用。Swagger UI默认会在`...
public ResponseEntity<String> protectedApi() { // 处理业务逻辑 } ``` 通过这种方式,Swagger不仅会生成API文档,还会展示需要认证的信息。用户在Swagger-UI中测试这些API时,需要在`Authorization`字段输入...
public ResponseEntity<List<User>> getUsers() { // ... } } ``` 3. **配置Swagger UI**:Swagger UI是一个Web界面,用于展示和测试你的API。你可以通过在Spring配置中添加一个静态资源处理器来提供这个界面。 ...
public ResponseEntity<String> createDocument(@RequestBody Map, Object> doc) { // Call Elasticsearch client to create the document } // Similar annotations for Read, Update and Delete methods } ``...
public ResponseEntity createUser(@RequestBody @ApiParam("用户信息") User user) { // 实现创建用户的逻辑 } } ``` 通过这些注解,Swagger可以自动收集到API的元数据,并生成清晰易懂的文档。 Swagger UI是...
public ResponseEntity<User> createUser(@RequestBody User user) { // 创建用户的逻辑 } } ``` 4. 完成上述步骤后,运行Spring Boot应用,Swagger的Web界面可以通过访问`...
Using SLF4J ............................................................................................ 13 Using Log4J ...................................................................................
Using SLF4J ............................................................................................ 13 Using Log4J ...................................................................................