public String toHeader ( ) { StringBuilder header = new StringBuilder ( ) ; header . append ( name ) . append ( ' ' ) . append ( value ) ; if ( domain != null ) { header . append ( "; " ) . append ( "Domain=" ) . append ( domain ) ; } if ( path != null ) { header . append ( "; " ) . append ( "Path=" ) . append ( path ) ; } if ( expireTime > - 1 ) { header . append ( "; " ) . append ( "Expires=" ) . append ( RFC_DATEFORMAT . format ( new Date ( expireTime ) ) ) ; } if ( secure ) { header . append ( "; " ) . append ( "Secure" ) ; } return header . toString ( ) ; }
Transforms this cookie into a Set - Cookie header field