The default path should be the context path or / and never and empty string.
If the cookie path is an empty string the "folder" of the current request path wil be used in the cookie. That 's not what you would expect.
We now set the path to / if the servlet context path is empty.
In addition we added
createCookie(String name, String value, int maxAge)