use of org.webpieces.httpparser.api.dto.ContentType in project webpieces by deanhiller.
the class FullResponse method extractCharset.
private Charset extractCharset() {
Header header = response.getHeaderLookupStruct().getHeader(KnownHeaderName.CONTENT_TYPE);
if (header == null)
throw new IllegalArgumentException("no ContentType header could be found");
ContentType ct = ContentType.parse(header);
Charset charset = DEFAULT_CHARSET;
if (ct.getCharSet() != null)
charset = Charset.forName(ct.getCharSet());
return charset;
}
Aggregations