@Override public InputStream asStream(String mimeType) { String charset = StringUtils.getCharsetFromContentType(mimeType); if (charset == null) { charset = defaultCharset; } try { return new StringInputStream(content, charset); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("unknown encoding: " + e); } } }
@Override protected String getCharacterEncoding() { String contentTypeHeaderValue = m_httpExchange.getRequestHeaders().getFirst(HttpHeaderAttribute.HEADER_NAME_CONTENTTYPE); if (contentTypeHeaderValue == null) { return null; } return StringUtils.getCharsetFromContentType(contentTypeHeaderValue); }