code: private static String convertV1SetCookie(HttpCookie cookie) {
          StringBuilder buffer = new StringBuilder(40);
  
          // Append name=value
          buffer.append(cookie.getName());
          buffer.append('=');
          maybeQuote(buffer, cookie.getValue());
  
          // insert version - required
          buffer.append("; Version=1");
  
          // check for optional comment
          String value = cookie.getComment();
          if (null != value && 0 != value.length()) {
              buffer.append("; Comment=");
              maybeQuote(buffer, value);
          }
  
          // check for optional domain
          value = cookie.getDomain();
          if (null != value && 0 != value.length()) {
              buffer.append("; Domain=");
              maybeQuote(buffer, value);
          }
  
          // check for optional max-age
          int maxAge = cookie.getMaxAge();
          if (-1 < maxAge) {
              buffer.append("; Max-Age=");
              buffer.append(maxAge);
          } else if (cookie.isDiscard()) {
              // convert discard to immediate max-age
              buffer.append("; Max-Age=0");
          }
  
          // check for optional path
          value = cookie.getPath();
          if (null != value && 0 != value.length()) {
              buffer.append("; Path=");
              if (!skipCookiePathQuotes) {
                  maybeQuote(buffer, value);
              } else {
                  buffer.append(value);
              }
          }
  
          if (cookie.isSecure()) {
              buffer.append("; Secure");
          }
  
          if (cookie.isHttpOnly()) {
              buffer.append("; HttpOnly");
          }
  
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
              Tr.debug(tc, "Created v1 Set-Cookie: [" + buffer.toString() + "]");
          }
  
          return buffer.toString();
      }
docs: Convert the V1 Cookie into a Set-Cookie header string.
  
  @param cookie
  @return the value of the header.