开发者

Why cant the container just use the IP address of the client? It is part of the request only

开发者 https://www.devze.com 2022-12-17 13:08 出处:网络
I like to know why can not the container just use IP address of the client to recongize the client. As IP address is u开发者_如何学JAVAnique.

I like to know why can not the container just use IP address of the client to recongize the client. As IP address is u开发者_如何学JAVAnique. Still does it need to create JSESSIONID?


IP Address is nowhere near unique.

  • It will be the same for people behind a router
  • It can change from request to request
  • Mobile phones tend to go via the same one
  • etc


If the client's IP changed, what will happen? And how if the client behind the proxy? Then there will be only one ID for all clients behind that proxy.


Are you talking about J2EE containers? I think that part of the reason is that HTTP is stateless.

The whole notion of a session is an abstraction that allows you to do more interesting things via HTTP as a sequence of interactions (e.g., shopping cart). Thus, sessions have a unique ID.

While it is common to have one session per IP, it is not rare to have multiple sessions from the same IP (e.g., think of yourself logged in several times to gmail), some IPs are hidden, and it is even possible to have your IP change during the session and use cookies or client memory to retain the session id.

0

精彩评论

暂无评论...
验证码 换一张
取 消