当前位置:网站首页>Cookie concept, basic use, principle, details and Chinese transmission

Cookie concept, basic use, principle, details and Chinese transmission

2022-07-06 01:25:00 Rain |

Cookie Exists in the browser , The browser can put Cookie The response is sent to the server , The browser can also request from the server Cookie

According to Cookie To set the required interface , Such as account number Remember my function

Basic use :

The browser sends Cookie:

1. establish Cookie

2. send out Cookie To the server

Get the server 's Cookie Array :

1. Receive all on the browser Cookie

2. Traverse to find what you need Cookie Output

principle :

Cookie The implementation is based on Http Agreed

Response head :set-cookie

Request header :cookie

If Tomcat It is found that there is Cookie, Then it will send a response header , What's in it is Cookie The key/value pair , The same applies to request headers

details :

By default Cookie The lifetime of is destroyed as the browser closes

have access to cookie.setMaxAge( Survival time ) Set up Cookie Life time of

  A positive number is the survival time

  A negative number means that the default browser is closed and destroyed

 0 To delete Cookie

Response Chinese Cookie:

Send and get servers Cookie when , Use URL Encoding and decoding can solve

Case study :

 

 

原网站

版权声明
本文为[Rain |]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140126206852.html