Storing multiple values ​​in cookies in Java

I see many solutions for storing multiple values ​​in one cookie in .Net and php, but I haven't found a good Java solution. I don't want to encode / decode value pairs myself, which can be risky.

+2


source to share


3 answers


Cookie values ​​are strings.

If you want to put structured data in them, you have to make that data a string.



Of course, you want clients to be able to read these values ​​easily. Query String encoded parameters or JSON seem to be good as they are browser native. JavaScript application can deserialize structured data.

+1


source


The usual approach is to store a unique id in a cookie (just a long number) and use a synchronized card in your code that gives you some data structure per id (often a different card).



0


source


HttpClient supports cookies .

0


source







All Articles