public class ContentTypeUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static Pattern |
CHARSET_PATTERN
正则:Content-Type中的编码信息
|
| 构造器和说明 |
|---|
ContentTypeUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
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 © 2023. All rights reserved.