protected Cookie createProxyCookie(HttpServletRequest servletRequest, HttpCookie cookie) {
    String proxyCookieName = getProxyCookieName(cookie);
    Cookie servletCookie = new Cookie(proxyCookieName, cookie.getValue());
    servletCookie.setPath(this.doPreserveCookiePath ?
       cookie.getPath() : // preserve original cookie path
       buildProxyCookiePath(servletRequest) //set to the path of the proxy servlet
    );
    servletCookie.setComment(cookie.getComment());
    servletCookie.setMaxAge((int) cookie.getMaxAge());
    // don't set cookie domain
    servletCookie.setSecure(servletRequest.isSecure() && cookie.getSecure());
    servletCookie.setVersion(cookie.getVersion());
    servletCookie.setHttpOnly(cookie.isHttpOnly());
    return servletCookie;
  }
Creates a proxy cookie from the original cookie.

@param servletRequest original request
@param cookie original cookie
@return proxy cookie
src/main/java/org/mitre/dsmiley/httpproxy/ProxyServlet.java