Javaweb Study Summary (iv)--http Agreement (1)

Source: Internet
Author: User

1.1. What is the HTTP protocol

Definition: Format specification for data transfer between browser client and server 1

1.2. How to view the HTTP protocol

1) Download Firebug plugin for Firefox browser (right-click Firebug-Network)

2). Use Google's "review element"

3). Use the system's own Telnet tool (Remote Access tool)

A) telnet localhost 8080 access to the Tomcat server

b) Ctrl + "]" Enter to see the Echo

c) Enter the requested content

GET/Access Web App path http/1.1host:localhost:8080

d) Enter, you can see the server response information

1.3.http protocol Content

The following is an example of a request, browser--"server

Get/day09/hello http/1.1host:localhost:8080user-agent:mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) gecko/20100101 firefox/35.0accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8accept-language:zh-cn,en-us;q=0.8,zh;q=0.5,en;q=0.3accept-encoding:gzip, Deflateconnection:keep-alive

Here is an example of a response, the server--"browser

http/1.1 Okserver:apache-coyote/1.1content-length:24date:fri, 01:54:57 gmtthis is Hello servlet!!!

Detailed analysis of the 1.4.http request

1.4.1. Request lines

#http协议版本

http1.0

Once the browser client has established a connection with the server, it can only send one request and close after one request

http1.1

Once the browser client has established a connection with the server, it can send multiple requests in one connection

#请求资源

URL: Uniform Resource Locator.

Http://localhost:8080/myweb/index.html

Can only define Internet resources, which is a subset of URIs

URI: Uniform Resource Tag

/day09/hello

Used to mark any resource. Can be local file system, LAN resource, or Internet

#请求方式

Common Request Methods:

GET, POST, HEAD, TRACE, PUT, CONNECT, DELETE

The most common way to request

GET and POST

In the front-end form submission

Choice of submission address, and choice of request method

<action= "Submit Address"  method= "Get/post">    <  form>

GET VS POST (difference)

1) Get mode submit

Get/day09/testmethod.html?name=eric&password=123456 http/1.1host:localhost:8080user-agent: mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) gecko/20100101 firefox/35.0accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8accept-language:zh-cn,en-us;q=0.8,zh;q=0.5,en;q=0.3accept-encoding:gzip, Deflatereferer:http://localhost : 8080/day09/testmethod.htmlconnection:keep-alive                                                                 

A) the Address bar (URI) will follow the parameters. To? Start with a & split between multiple parameters

b) The parameter data submitted by the Get method is limited, no more than 1KB

c) Get mode is not suitable for submitting sensitive passwords

D) The browser accesses the request directly, by default is the Get method

2) Post mode submission

Request Line:
post/day09/testmethod.html http/1.1host:localhost:8080 Request Header:
user-agent:mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) gecko/20100101 firefox/35.0accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q= 0.8accept-language:zh-cn,en-us;q=0.8,zh;q=0.5,en;q=0.3accept-encoding:gzip, Deflatereferer:http://localhost : 8080/day09/testmethod.htmlconnection:keep-alive Entity content:name=cxpace&password=123456

A) The parameter is not followed by the URI. The parameter is in the requested entity content. No? Starting with the concept of multiple parameters & splits

b) post-submitted parameter data is not limited in principle

c) Post mode to submit sensitive data

1.4.2 Request Header

accept:text/html,image/*      --Browser accepts the data type Accept-charset:iso-8859-1     --The browser accepts the encoding format accept-encoding:gzip, Compress  --the browser accepts the data compression format accept-language:en-us,zh---       The browser accepts the language host:www.cxspace.com:80          -- (required) The destination address (host: port) of the current request access If-modified-since:tue, 18:23:51 GMT  -the last cache time for the browser referer:http:// Www.cxspace.com/index.html      -where the current request came from user-agent:mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)  --Browser type cookie:name=cxspace--                     browser-saved cookie information connection:close/keep-alive            -- Browser and server connection status. Close: Connection closed  keep-alive: Save connection. Date:tue, Jul 18:23:51 GMT      -time of request

1.4.3 Entity Content

Only post-submitted parameters are placed in the entity content

Javaweb Study Summary (iv)--http Agreement (1)

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.