@SuppressWarnings("lgtm[java/insecure-cookie]") // We're explicitly setting an empty cookie to remove things.
    public static void deleteCookie(HttpServletRequest request, HttpServletResponse response,
            Cookie cookie)
    {
        if (cookie != null) {
            // Invalidate the cookie
            String path = request.getContextPath() == null ? "/" : request.getContextPath();
            if ("".equals(path)) {
                path = "/";
            }
            cookie.setPath(path);
            cookie.setValue("");
            cookie.setMaxAge(0);
            response.addCookie(cookie);
        }
    }
Deletes the specified cookie.

@param request the servlet request.
@param response the servlet response.
@param cookie the cookie object to be deleted.
xmppserver/src/main/java/org/jivesoftware/util/CookieUtils.java