This commit is contained in:
Greg Wilkins 2017-03-30 11:20:39 +11:00
parent 9732e3a985
commit 70d33eab5d
1 changed files with 14 additions and 4 deletions

View File

@ -119,6 +119,7 @@ public class Response implements HttpServletResponse
private enum EncodingFrom { NOT_SET, INFERRED, SET_LOCALE, SET_CONTENT_TYPE, SET_CHARACTER_ENCODING };
private static final EnumSet<EncodingFrom> __localeOverride = EnumSet.of(EncodingFrom.NOT_SET,EncodingFrom.INFERRED);
private static final EnumSet<EncodingFrom> __explicitCharset = EnumSet.of(EncodingFrom.SET_LOCALE,EncodingFrom.SET_CHARACTER_ENCODING);
public Response(HttpChannel channel, HttpOutput out)
@ -1425,10 +1426,19 @@ public class Response implements HttpServletResponse
HttpField ct=content.getContentType();
if (ct!=null)
{
_fields.put(ct);
_contentType=ct.getValue();
_characterEncoding=content.getCharacterEncoding();
_mimeType=content.getMimeType();
if (_characterEncoding!=null &&
content.getCharacterEncoding()==null &&
__explicitCharset.contains(_encodingFrom))
{
setContentType(content.getMimeType().getBaseType().asString());
}
else
{
_fields.put(ct);
_contentType=ct.getValue();
_characterEncoding=content.getCharacterEncoding();
_mimeType=content.getMimeType();
}
}
HttpField ce=content.getContentEncoding();