I just started with Java servlets few days ago. I am trying to develop a program just for practice and to get to know the the stuff we can do with Java servlets.
Trying to have a program that generates a cookie and sends it back to the client in response.
Sending back the cookie and getting cookie info back is fine, but what I want to do is that can we get information about the clients environment using cookies as well as can we get the browser information using cookies, such as which browser, its version, OS, etc.
I know they store state information since HTTP is stateless. So I was just wondering and trying is there a way to get client’s environment information and browser information by cookies in servlets.
Cookies are not designed to get client information. You have to use
javax.servlet.http.HttpServletRequestmethods –getHeader()orgetHeaders()method to read request header key-value.Want to get value of
user-agentkey.