public static Cookie newCookie(String name,String value,int maxAge,String path,String domain){
  Cookie cookie=null;
  if (cookieEncoding) {
    cookie=new Cookie(name,URLEncDec.encode(value));
  }
 else {
    cookie=new Cookie(name,value);
  }
  cookie.setMaxAge(maxAge);
  if ((path != null) && (path.length() > 0)) {
    cookie.setPath(path);
  }
 else {
    cookie.setPath("/");
  }
  if ((domain != null) && (domain.length() > 0)) {
    cookie.setDomain(domain);
  }
  cookie.setSecure(isCookieSecure());
  return cookie;
}

public static Cookie newCookie ( String name , String value , int maxAge , String path , String domain ) { Cookie cookie = null ; if ( cookieEncoding ) { cookie = new Cookie ( name , URLEncDec . encode ( value ) ) ; } else { cookie = new Cookie ( name , value ) ; } cookie . setMaxAge ( maxAge ) ; if ( ( path != null ) && ( path . length ( ) > 0 ) ) { cookie . setPath ( path ) ; } else { cookie . setPath ( "/" ) ; } if ( ( domain != null ) && ( domain . length ( ) > 0 ) ) { cookie . setDomain ( domain ) ; } cookie . setSecure ( isCookieSecure ( ) ) ; return cookie ; }
constructs a cookie with a specified name and value and sets the maximum age of the cookie in seconds and sets a path for the cookie to which the client should return the cookie and sets the domain within which this cookie should be presented .
