public Optional<String> toContentTypeHeader() {
        return contentType.map(ct -> {
            if (charset.isPresent()) {
                return ct + "; charset=" + charset.get();
            } else {
                return ct;
            }
        });
    }
public Optional < String > toContentTypeHeader ( ) { return contentType . map ( ct -> { if ( charset . isPresent ( ) ) { return ct + "; charset=" + charset . get ( ) ; } else { return ct ; } } ) ; }
Convert this message protocol to a content type header, if the content type is defined.

@return The message protocol as a content type header.