code: public final void write(T t, MediaType contentType, HttpOutputMessage outputMessage)
  			throws IOException, HttpMessageNotWritableException {
  
  		HttpHeaders headers = outputMessage.getHeaders();
  		if (headers.getContentType() == null) {
  			MediaType contentTypeToUse = contentType;
  			if (contentType == null || contentType.isWildcardType() || contentType.isWildcardSubtype()) {
  				contentTypeToUse = getDefaultContentType(t);
  			}
  			if (contentTypeToUse != null) {
  				headers.setContentType(contentTypeToUse);
  			}
  		}
  		if (headers.getContentLength() == -1) {
  			Long contentLength = getContentLength(t, headers.getContentType());
  			if (contentLength != null) {
  				headers.setContentLength(contentLength);
  			}
  		}
  		writeInternal(t, outputMessage);
  		outputMessage.getBody().flush();
  	}
docs: This implementation delegates to {@link #getDefaultContentType(Object)} if a content
  type was not provided, calls {@link #getContentLength}, and sets the corresponding headers
  on the output message. It then calls {@link #writeInternal}.