| 程序包 | 说明 |
|---|---|
| cn.ponfee.commons.http | |
| cn.ponfee.commons.web |
| 限定符和类型 | 方法和说明 |
|---|---|
static ContentType |
ContentType.ofValue(String value) |
static ContentType |
ContentType.valueOf(String name)
返回带有指定名称的该类型的枚举常量。
|
static ContentType[] |
ContentType.values()
按照声明该枚举类型的常量的顺序, 返回
包含这些常量的数组。
|
| 限定符和类型 | 方法和说明 |
|---|---|
Http |
Http.accept(ContentType contentType)
内容类型发送请求头,告诉服务器什么样的响应会接受返回
header("Accept", contentType)
|
Http |
Http.contentType(ContentType contentType) |
Http |
Http.contentType(ContentType contentType,
String contentCharset)
请求实体报头,发送信息至服务器时内容编码类型:
multipart/form-data,application/x-www-form-urlencoded,
application/json
默认:application/x-www-form-urlencoded
调用方式:contentType("application/json", "UTF-8")
|
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
WebUtils.response(javax.servlet.http.HttpServletResponse resp,
byte[] data,
ContentType contentType,
boolean isGzip)
响应数据流,如图片数据
response(resp, image_byte_array, ContentType.IMAGE_JPEG.value(), false);
|
static void |
WebUtils.response(javax.servlet.http.HttpServletResponse resp,
ContentType contentType,
String text,
String charset)
响应数据到请求客户端
|
static void |
WebUtils.response(javax.servlet.http.HttpServletResponse resp,
InputStream input,
ContentType contentType,
boolean isGzip)
响应数据流,如图片数据
response(resp, image_file_input_stream, ContentType.IMAGE_JPEG.value(), false);
|
Copyright © 2023. All rights reserved.