Java Web: httpxiey and javawebhttpxiey

Source: Internet
Author: User

Java Web: httpxiey and javawebhttpxiey
Http protocol for Java Web

1. What is http?

Http (Hypertext Transfer Protocol) is a network data transmission format, which specifies the data format of requests and responses in an interaction, it is embodied in the packet format transmitted over the network, one request and one response

2. Request

Requests include: request line request header Request body

Request Line:

Format: Request Method resource path Protocol version

Result of the packet capture request:

      

Request Header:

Key/value pairs after the end of the Request Line

Accept: text/html, image/* -- supports data types
Accept-Charset: ISO-8859-1 -- Character Set
Accept-Encoding: gzip -- supports Compression
Accept-Language: zh-cn -- Language environment
Host: www.baidu.com: 80 -- access Host
If-Modified-Since: Tue, 11 Jul 2000 18:23:51 GMT -- last modification time of the cache file
Referer: http://www.itcast.com/index.jsp-from which page, anti-leech
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) browser Information
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv: 57.0) Gecko/20100101 Firefox/57.0

Connection: close/Keep-Alive -- Link Status

      

  

 

 

Request body: the parameters that the client sends to the server.

End the next line in the Request Header

3. Response

The response is the response from the server to the client.

Includes: Response Header body

Response line:

Format: Protocol version Status Code Description

      

Status Code: Summary of the current response
1xx: indicates that the server has received the request but the data is not ready.
2xx: indicates a successful response.
200
3xx: indicates that you need further operations to obtain the desired resource.
304: Cache
302: Redirection
Location: Jump address

4xx: user error
404: The address is incorrect.
405: Incorrect Request Method

5xx: Server errors
500: Code logic error

Response Header:

The response header is displayed as a key-value pair.

Location: http://www.it315.org/index.jsp -- redirect
Server: apache tomcat-Server Model
Content-Encoding: gzip -- Data Compression
Content-Length: 80 -- Data Length
Content-Language: zh-cn-Language environment
Content-Type: text/html; charset = GB2312 -- Data Type big data Type/Small Data Type image/png image/jpeg
Last-Modified: Tue, 11 Jul 2000 18:23:51 GMT -- Last modification time
Refresh: 1; url = http://www.it315.org -- timed Refresh
Content-Disposition: attachment; filename=aaa.zip -- Download
Set-Cookie: SS = Q0 = 5Lb_nQ; path =/search
Expires:-1 -- Cache
Cache-Control: no-cache -- Cache
Pragma: no-cache -- cache
Connection: close/Keep-Alive -- Connection

Response body
The Response Header ends the next line.
Storage is the response body you want

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.