@Test public void shouldReturnDefaultCharsetWhenContentTypeHeaderDoesNotExist() { HttpHeaders httpHeaders = new HttpHeaders(headers); String charset = httpHeaders.getCharsetFromContentType("UTF-8"); assertEquals("UTF-8", charset); }
public String getCharsetFromContentType(String defaultCharset) { String charset = null; String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { charset = new ContentType(contentTypeStr).getCharset(); } return charset != null ? charset : defaultCharset; }
HttpHeaders { public String getCharsetFromContentType(String defaultCharset) { String charset = null; String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { charset = new ContentType(contentTypeStr).getCharset(); } return charset != null ? charset : defaultCharset; } }
HttpHeaders { public String getCharsetFromContentType(String defaultCharset) { String charset = null; String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { charset = new ContentType(contentTypeStr).getCharset(); } return charset != null ? charset : defaultCharset; } HttpHeaders(HeaderMap headers); }
HttpHeaders { public String getCharsetFromContentType(String defaultCharset) { String charset = null; String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { charset = new ContentType(contentTypeStr).getCharset(); } return charset != null ? charset : defaultCharset; } HttpHeaders(HeaderMap headers); String getCharsetFromContentType(String defaultCharset); void setContentType(String typeSubtype); void incrementContentLength(int additionalContentLength); }
HttpHeaders { public String getCharsetFromContentType(String defaultCharset) { String charset = null; String contentTypeStr = headers.get(CONTENT_TYPE); if (contentTypeStr != null) { charset = new ContentType(contentTypeStr).getCharset(); } return charset != null ? charset : defaultCharset; } HttpHeaders(HeaderMap headers); String getCharsetFromContentType(String defaultCharset); void setContentType(String typeSubtype); void incrementContentLength(int additionalContentLength);  }