@Override public void setCharacterEncoding(String characterEncoding) { this.characterEncoding = characterEncoding; this.charset = true; updateContentTypeHeader(); }
@Override public void setContentType(@Nullable String contentType) { this.contentType = contentType; if (contentType != null) { try { MediaType mediaType = MediaType.parseMediaType(contentType); if (mediaType.getCharset() != null) { this.characterEncoding = mediaType.getCharset().name(); this.charset = true; } } catch (Exception ex) { // Try to get charset value anyway int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX); if (charsetIndex != -1) { this.characterEncoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length()); this.charset = true; } } updateContentTypeHeader(); } }
@Override public void setCharacterEncoding(String characterEncoding) { this.characterEncoding = characterEncoding; this.charset = true; updateContentTypeHeader(); }
@Override public void setCharacterEncoding(String characterEncoding) { this.characterEncoding = characterEncoding; this.charset = true; updateContentTypeHeader(); }
@Override public void setContentType(@Nullable String contentType) { this.contentType = contentType; if (contentType != null) { try { MediaType mediaType = MediaType.parseMediaType(contentType); if (mediaType.getCharset() != null) { this.characterEncoding = mediaType.getCharset().name(); this.charset = true; } } catch (Exception ex) { // Try to get charset value anyway int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX); if (charsetIndex != -1) { this.characterEncoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length()); this.charset = true; } } updateContentTypeHeader(); } }
@Override public void setContentType(String contentType) { this.contentType = contentType; if (contentType != null) { try { MediaType mediaType = MediaType.parseMediaType(contentType); if (mediaType.getCharset() != null) { this.characterEncoding = mediaType.getCharset().name(); this.charset = true; } } catch (Exception ex) { // Try to get charset value anyway int charsetIndex = contentType.toLowerCase().indexOf(CHARSET_PREFIX); if (charsetIndex != -1) { this.characterEncoding = contentType.substring(charsetIndex + CHARSET_PREFIX.length()); this.charset = true; } } updateContentTypeHeader(); } }