Forums Register Login
Servlet can't send cookie for the first request by client
I want to create a cookie wich keeps the number of visits on persistent storage on client side, my server is simple servlet wich runs on Apache Tomcat 8.0,
- when the client sends a cookie already initialized with counter (for example counter = 12), the server increments the counter and sends back new cookie with new counter (counter = 13) and it's saved correctly by the client on my hard drive. This works fine for me.
- but when the client sends a request for the first time, so no cookie is sent to server, and the server should create new cookie with counter = 0 and sends it back to client. This case doesn't work correctly and the client doesn't receive any cookie.
Here's my code example :

please buy my thing and then I'll have more money:
Thread Boost - a very different sort of advertising

This thread has been viewed 527 times.

All times above are in ranch (not your local) time.
The current ranch time is
Apr 26, 2018 09:38:54.