static String pathToCookiePath(String path){
  if (path == null) {
    return "/";
  }
  int lastSlash=path.lastIndexOf('/');
  return path.substring(0,lastSlash + 1);
}

static String pathToCookiePath ( String path ) { if ( path == null ) { return "/" ; } int lastSlash = path . lastIndexOf ( '/' ) ; return path . substring ( 0 , lastSlash + 1 ) ; }
returns a cookie - safe path by truncating everything after the last " / " . when request path like " / foo / bar . html " yields a cookie , that cookie ' s default path is " / foo / " .
