MCPcopy Index your code
hub / github.com/apache/tomcat / getCharsetFromContentType

Method getCharsetFromContentType

java/org/apache/coyote/Request.java:1340–1357  ·  view source on GitHub ↗

Parse the character encoding from the specified content type header. If the content type is null, or there is no explicit character encoding, null is returned. @param contentType a content type header

(String contentType)

Source from the content-addressed store, hash-verified

1338 * @param contentType a content type header
1339 */
1340 private static String getCharsetFromContentType(String contentType) {
1341
1342 if (contentType == null) {
1343 return null;
1344 }
1345
1346 MediaType mediaType = null;
1347 try {
1348 mediaType = MediaType.parseMediaType(new StringReader(contentType));
1349 } catch (IOException ioe) {
1350 // Ignore - null test below handles this
1351 }
1352 if (mediaType != null) {
1353 return mediaType.getCharset();
1354 }
1355
1356 return null;
1357 }
1358}

Callers 2

getCharacterEncodingMethod · 0.95
getCharsetHolderMethod · 0.95

Calls 2

parseMediaTypeMethod · 0.95
getCharsetMethod · 0.95

Tested by

no test coverage detected