Java Servlets manages cookies and is transparent to you, under the hood. Tomcat is a web server running Java servlets.
How web servers manage cookies, they send them directly to an HTTP request, I’m not 100% sure of the protocol text, but I believe that just Tomcat will send “SET COOKIE: ...” to the actual HTTP that is sent to your browser.
It is important to note that Tomcat and the java servlet specification are related - Tomcat hosts servlets and provides interface implementations that wrap basic aspects of HTTP communication: for example, here is its Cookie interface ---- http://tomcat.apache.org/tomcat-5.5 -doc / servletapi / javax / servlet / http / Cookie.html .
In general, this should not cause much concern when writing a web application, unless you are doing something unusual. It is assumed that the Servlet api can abstract this by giving you access to the session API, which allows you to set / receive objects specific to the client you are dealing with.
source share