1、 What is? http agreement

http agreement : Browser client And   Server side The specification of data transmission between

2、 see http Tools of agreement

1) How to use Firefox firebug plug-in unit ( Right click -> Check out the elements -> The Internet )

2) Using Google's “ Review element ”

3) Use the system's own telnet Tools ( Remote access tools )

4)telnet Turn on -  stay windows “ Add and remove features ” Check in telnet The client can

a)telnet localhost 8080      visit tomcat The server

b)ctrl+]     enter           You can see the echo

c) Enter the content of the request

GET /webtest/hello HTTP/1.1

Host: localhost:8080

d) enter , You can view the server response information .

4、http Content of agreement

request ( browser -》 The server )

GET /day09/hello HTTP/1.1

Host: localhost:8080

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: zh-cn,en-us;q=0.8,zh;q=0.5,en;q=0.3

Accept-Encoding: gzip, deflate

Connection: keep-alive

Respond to ( The server -》 browser )

HTTP/1.1 200 OK

Server: Apache-Coyote/1.1

Content-Length: 24

Date: Fri, 30 Jan 2015 01:54:57 GMT

this is hello servlet!!!

GET /day09/hello HTTP/1.1               - Request line

Host: localhost:8080                    -- Request header ( Multiple key-value object )

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: zh-cn,en-us;q=0.8,zh;q=0.5,en;q=0.3

Accept-Encoding: gzip, deflate

Connection: keep-alive

-- A blank line

name=eric&password=123456             --( Optional ) Entity content

Request line

GET /day09/hello HTTP/1.1

#http Protocol version

http1.0: After the current browser client establishes a connection with the server , Only one request can be sent , The connection is closed after one request .

http1.1: After the current browser client establishes a connection with the server , You can send multiple requests in one connection .( Basically use 1.1)

# Request resources

URL:  Uniform resource locator .http://localhost:8080/day09/testImg.html. We can only locate Internet resources . yes URI                                                         Subset .

URI: Uniform resource flags ./day09/hello. Used to mark any resource . It could be a local file system , LAN resources (//192.168.14.10/myweb/index.html),                                                   It could be the Internet .

# Request mode

Common request methods : GET 、 POST、 HEAD、 TRACE、 PUT、 CONNECT 、DELETE

Common request methods : GET  and POST

Form submission :

<form action=" Submit the address " method="GET/POST">

<form>

GET   vs  POST difference

1)GET Mode submission

a) Address bar (URI) Will keep up with the parameter data . With ? start , Between multiple parameters with & Division .

GET /day09/testMethod.html?name=eric&password=123456 HTTP/1.1

Host: localhost:8080

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: zh-cn,en-us;q=0.8,zh;q=0.5,en;q=0.3

Accept-Encoding: gzip, deflate

Referer: http://localhost:8080/day09/testMethod.html

Connection: keep-alive

b)GET There are restrictions on submitting parameter data , No more than 1KB.

c)GET The method is not suitable for submitting sensitive passwords .

d) Be careful : Browser direct access request , The default submission method is GET The way

2)POST Mode submission

a) Parameters don't follow URI Back . Parameters follow the entity content of the request . No, ? start , Between multiple parameters with & Division .

POST /day09/testMethod.html HTTP/1.1

Host: localhost:8080

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: zh-cn,en-us;q=0.8,zh;q=0.5,en;q=0.3

Accept-Encoding: gzip, deflate

Referer: http://localhost:8080/day09/testMethod.html

Connection: keep-alive

name=eric&password=123456

b)POST There is no limit to the parameter data submitted .

c)POST How to submit sensitive data .

Request header

Accept: text/html,image/*      -- The type of data the browser accepts

Accept-Charset: ISO-8859-1     -- The encoding format accepted by the browser

Accept-Encoding: gzip,compress  -- The data compression format accepted by the browser

Accept-Language: en-us,zh-       -- The language the browser accepts

Host: www.it315.org:80          --( necessary ) The destination address of the current request ( host : port )

If-Modified-Since: Tue, 11 Jul 2000 18:23:51 GMT  -- Browser last cache time

Referer: http://www.it315.org/index.jsp      -- Where does the current request come from

User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)  -- Browser type

Cookie:name=eric                     -- Browser saved cookie Information

Connection: close/Keep-Alive            -- Browser to server connection status .close: Connection is closed   keep-alive: Save connection .

Date: Tue, 11 Jul 2000 18:23:51 GMT      -- When the request was sent

Entity content

Only POST The submitted parameters are put into the entity content

HttpServletRequest object

HttpServletRequest Object is used to get request data .

The core API:

Request line :

request.getMethod();    Request mode

request.getRequetURI()   / request.getRequetURL()   Request resources

request.getProtocol()   request http Protocol version

Request header :

request.getHeader(" name ")   Get the request value according to the request header

request.getHeaderNames()    Get all request header names

Entity content :

request.getInputStream()   Get entity content data

HTTP More articles on protocol simplification

  1. 【 Reprint 】TCP /IP protocol

    First ,TCP/IP It's not an agreement , It's an umbrella term for a family of agreements . It includes IP agreement ,IMCP agreement ,TCP agreement , as well as http.ftp.pop3 Protocol, etc . TCP/IP Protocol layer When it comes to protocol layering , It's easy for us to associate IS ...

  2. Efficient development SASS piece Psychic blank Events —— The bottom of the picture is left blank for no reason You can use ::before、::after Do you link And @import Contrast of What you need to know before you learn the front end ——HTTP protocol Deepen understanding ——CSS3 New properties Rookie advanced ——grunt $(#form :input) And $(#form input) The difference between

    Efficient development SASS piece   As a common learning bird on the road to the front end God , Recently, I came into contact with a slightly more powerful artifact , I'd like to share with you ~ Who is he? ? As a front-end developer , You must be right css Familiar with , But you know css Can I customize it ? everyone ...

  3. TCP /IP protocol 【 turn 】

    from :https://www.jianshu.com/p/0cf648510bce?utm_campaign=maleskine&utm_content=note&utm_medium ...

  4. STOMP protocol

      STOMP protocol author :chszs, Reprint should indicate . Blog home page :http://blog.csdn.net/chszs One .STOMP Protocol is introduced STOMP namely Simple (or Streaming) T ...

  5. SSL/TLS protocol ( On ): Cipher suite , Hash , encryption , Key exchange algorithm

    Reprinted from SSL/TLS protocol ( On ): Cipher suite , Hash , encryption , Key exchange algorithm Introduction As a security enthusiast , I always like SSL( At present, it is TLS) How it works . It took me days to understand the basic principles of this complex protocol , But as long as ...

  6. HTTP protocol ( turn )

    from :http://blog.csdn.net/gueter/archive/2007/03/08/1524447.aspx Author :Jeffrey introduction HTTP It's an object-oriented one that belongs to the application layer ...

  7. HTTP protocol

    Author :Jeffrey introduction HTTP Is an object-oriented protocol belonging to the application layer , Because of its simplicity . Fast way , Suitable for distributed hypermedia information system . It's on 1990 in , After several years of use and development , Get continuous improvement and Expand . ...

  8. Dynamic route selection 、RIP agreement &amp;&amp;OSPF protocol

    Dynamic route selection .RIP agreement &&OSPF protocol Concept When adjacent routers communicate with each other , To tell each other what network each router is currently connected to , Then there is dynamic routing . Routers must use routing protocol to communicate with each other , Such routing protocols ...

  9. ASP.NET Knowledge summary (3.HTTP protocol )

    introduction HTTP Is an object-oriented protocol belonging to the application layer , Because of its simplicity . Fast way , Suitable for distributed hypermedia information system . It's on 1990 in , After several years of use and development , To be continuously perfected and expanded . Currently in WWW Is used in HTTP/1. ...

Random recommendation

  1. 1Z0-053 Analysis of controversial topics 512

    1Z0-053 Analysis of controversial topics 512 Examination subjects :1Z0-053 Question bank version :V13.02 The original question in the question bank is : 512.Which two statements correctly describe the r ...

  2. Redis note , Installation and common commands

    Reproduced in :http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/96.html?1455870708 One .redis Brief introduction redis yes N ...

  3. H5 Common code : Page frame

    All change is the same , Natural rule ! although H5 We've got a wave of small projects , But there's one thing that hasn't changed much , That's the frame structure of the whole page . I often use H5 Common page frames are as follows : <!DOCTYPE html> <ht ...

  4. swift Study notes - Closure

    // Closure import UIKit /* Closure (Closures): function . Closure . Classes are all reference types ( When an instance of a reference type is assigned to a variable or constant , All you get are references to the instance , The instance variable of value type gets the copy of independent value ) 1 ...

  5. rdlc Report Viewer Configuration Error

    Mainly web.config No configuration Method reference http://msdn.microsoft.com/zh-cn/library/ms251661.aspx

  6. javax.mail.MessagingException: 501 Syntax: HELO hostname Linux End exception resolution

    Use... In projects javamail stay window The environment is normal , Throw an exception when placing it on the server javax.mail.MessagingException: 501 Syntax: HELO hostname , primary ...

  7. Save output to a text file from Mac terminal

      Simply with output redirection: system_profiler > file.txt Basically, this will take the output ...

  8. apache Don't parse php file ? Prompt to download ( turn )

    stay httpd.cong in LoadModule php5_module modules/libphp5.so # This business php5 It was added automatically when it was installed AddType application/x- ...

  9. Use REST Style complete MVC Fore and aft end separation

    One has REST The basic characteristics of style projects : It has a unified response structure Front and back data flow mechanism (HTTP News and Java The mutual transformation mechanism of objects ) Unified exception handling mechanism Parameter validation mechanism Cors Cross domain request mechanism Authentication mechanism One : Unified response ...

  10. C# Medium PropertyGrid Bound object , By changing a certain value and dynamically setting the properties of some properties

    problem : as follows , I defined an object , Default settings properties WindowSize ,WindowSize It is invisible , By changing SaveOnClose Value , Dynamically change the display and hide of invisible attributes . [DefaultProper ...