@Test public void shouldReplaceContentTypeWhenItAlreadyExists() { headers.put(CONTENT_TYPE, "application/json"); HttpHeaders httpHeaders = new HttpHeaders(headers); httpHeaders.setContentType("application/javascript"); assertEquals("application/javascript", headers.get(CONTENT_TYPE)); }
public void setContentType(String typeSubtype) { String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { ContentType contentType = new ContentType(contentTypeStr); contentType.setTypeSubtype(typeSubtype); headers.put(CONTENT_TYPE, contentType.toString()); } else { headers.put(CONTENT_TYPE, typeSubtype); } }
HttpHeaders { public void setContentType(String typeSubtype) { String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { ContentType contentType = new ContentType(contentTypeStr); contentType.setTypeSubtype(typeSubtype); headers.put(CONTENT_TYPE, contentType.toString()); } else { headers.put(CONTENT_TYPE, typeSubtype); } } }
HttpHeaders { public void setContentType(String typeSubtype) { String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { ContentType contentType = new ContentType(contentTypeStr); contentType.setTypeSubtype(typeSubtype); headers.put(CONTENT_TYPE, contentType.toString()); } else { headers.put(CONTENT_TYPE, typeSubtype); } } HttpHeaders(HeaderMap headers); }
HttpHeaders { public void setContentType(String typeSubtype) { String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { ContentType contentType = new ContentType(contentTypeStr); contentType.setTypeSubtype(typeSubtype); headers.put(CONTENT_TYPE, contentType.toString()); } else { headers.put(CONTENT_TYPE, typeSubtype); } } HttpHeaders(HeaderMap headers); String getCharsetFromContentType(String defaultCharset); void setContentType(String typeSubtype); void incrementContentLength(int additionalContentLength); }
HttpHeaders { public void setContentType(String typeSubtype) { String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { ContentType contentType = new ContentType(contentTypeStr); contentType.setTypeSubtype(typeSubtype); headers.put(CONTENT_TYPE, contentType.toString()); } else { headers.put(CONTENT_TYPE, typeSubtype); } } HttpHeaders(HeaderMap headers); String getCharsetFromContentType(String defaultCharset); void setContentType(String typeSubtype); void incrementContentLength(int additionalContentLength);  }