public class ContentTypeUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static Pattern |
CHARSET_PATTERN
正则:Content-Type中的编码信息
|
| Constructor and Description |
|---|
ContentTypeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Charset |
getCharset(String contentType)
从Http连接的头信息中获得字符集
从ContentType中获取 |
static String |
getCharsetName(String contentType)
从Http连接的头信息中获得字符集
从ContentType中获取 |
static String |
getContentTypeByRequestBody(String body)
从请求参数的body中判断请求的Content-Type类型,支持的类型有:
1. application/json
1. application/xml
|
public static final Pattern CHARSET_PATTERN
public static Charset getCharset(String contentType)
contentType - Content-Typepublic static String getCharsetName(String contentType)
contentType - Content-Typepublic static String getContentTypeByRequestBody(String body)
1. application/json 1. application/xml
body - 请求参数体ContentType.get(String)Copyright © 2025. All rights reserved.