The primary purpose a cookie serves is to persist a small amount of state, remember that HTTP is stateless, in the browser without requiring that the data be re-added to every form request. For an explicit, real world example, consider why one would use URL Rewriting instead of (or in addition) to a session tracking cookie.
Is cookie part of the header of a http request/response? Is it a key value pair? How different is it than Accept or Content-type header keys? [duplicate]
-
30-07-2022 - |
Question
What is the difference between an http header and a cookie? I'm learning Jsps and Servlets. I am not understanding how a cookie is different than other header attributes..
For example: An http request would contain a list of header key-values. One of the header keys is a cookie. Just like connection: Keep-Alive
or accept-language: en-us
Correct?
Solution
OTHER TIPS
Cookies are like temporary storage of data on client side. browser put cookies in his temp directory and send these with each request .
But headers are hints to browser and server . to prepare himself . like content type
header it tells that the request is sending data of that particular type like application/json
will send json data now server will decide whether it can handle this(type)
or not if it can not it will rise exception.