|
|
|
@ -226,7 +226,7 @@ public class MockHttpServletResponse implements HttpServletResponse { |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ignored) { |
|
|
|
catch (Exception ignored) { |
|
|
|
String value = this.contentType; |
|
|
|
String value = this.contentType; |
|
|
|
int charsetIndex = value.toLowerCase().indexOf(CHARSET_PREFIX); |
|
|
|
int charsetIndex = value.toLowerCase(Locale.ROOT).indexOf(CHARSET_PREFIX); |
|
|
|
if (charsetIndex != -1) { |
|
|
|
if (charsetIndex != -1) { |
|
|
|
value = value.substring(0, charsetIndex).trim(); |
|
|
|
value = value.substring(0, charsetIndex).trim(); |
|
|
|
if (value.endsWith(";")) { |
|
|
|
if (value.endsWith(";")) { |
|
|
|
@ -246,7 +246,7 @@ public class MockHttpServletResponse implements HttpServletResponse { |
|
|
|
private void updateContentTypePropertyAndHeader() { |
|
|
|
private void updateContentTypePropertyAndHeader() { |
|
|
|
if (this.contentType != null) { |
|
|
|
if (this.contentType != null) { |
|
|
|
String value = this.contentType; |
|
|
|
String value = this.contentType; |
|
|
|
if (this.characterEncodingSet && !value.toLowerCase().contains(CHARSET_PREFIX)) { |
|
|
|
if (this.characterEncodingSet && !value.toLowerCase(Locale.ROOT).contains(CHARSET_PREFIX)) { |
|
|
|
value += ';' + CHARSET_PREFIX + getCharacterEncoding(); |
|
|
|
value += ';' + CHARSET_PREFIX + getCharacterEncoding(); |
|
|
|
this.contentType = value; |
|
|
|
this.contentType = value; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -358,7 +358,7 @@ public class MockHttpServletResponse implements HttpServletResponse { |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) { |
|
|
|
catch (Exception ex) { |
|
|
|
// Try to get charset value anyway
|
|
|
|
// Try to get charset value anyway
|
|
|
|
int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX); |
|
|
|
int charsetIndex = contentType.toLowerCase(Locale.ROOT).indexOf(CHARSET_PREFIX); |
|
|
|
if (charsetIndex != -1) { |
|
|
|
if (charsetIndex != -1) { |
|
|
|
setExplicitCharacterEncoding(contentType.substring(charsetIndex + CHARSET_PREFIX.length())); |
|
|
|
setExplicitCharacterEncoding(contentType.substring(charsetIndex + CHARSET_PREFIX.length())); |
|
|
|
} |
|
|
|
} |
|
|
|
|