public class HttpResponseImpl extends Object implements HttpResponse
| 构造器和说明 |
|---|
HttpResponseImpl(Client client) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
acceptRanges(boolean acceptRanges)
是否允许分段下载(206状态码)
|
void |
addCookie(HttpCookie httpCookie)
添加Cookie信息
|
void |
addHeader(String name,
String value)
添加Header信息
|
void |
charset(String charset)
指定编码格式
|
void |
download(String filePath)
下载文件
|
void |
eventSource(EventSource eventSource)
使用EventSource推送事件
|
void |
fillHeadStream()
填充http头部
|
String |
getCharset()
获取编码格式
|
String |
getContentDisposition()
获取Content-Disposition头部信息
|
String |
getContentType()
获取Content-Type头部信息
|
List<String> |
getHeader(String name)
获取Header信息
|
OutputStream |
getOutputStream()
获取输出流
|
void |
httpStatus(HttpStatus httpStatus)
设置返回状态码
|
void |
redirect(String url)
重定向
|
void |
setCharset(Charset charset)
设置编码格式
|
void |
setCharset(String charset)
设置编码格式
|
void |
setContentDisposition(String fileName)
设置Content-Disposition头部信息
|
void |
setContentLength(long contentLength)
设置Content-Length头部
|
void |
setContentType(String contentType)
设置Content-Type头部信息
|
void |
setHeader(String name,
String value)
设置Header信息
|
void |
status(HttpStatus httpStatus)
指定状态码
|
void |
streamingBody(String data)
输出字符串信息
|
void |
streamingBodyLine(String data)
输出一行字符串信息
|
public HttpResponseImpl(Client client)
public void status(HttpStatus httpStatus)
HttpResponsestatus 在接口中 HttpResponsepublic void charset(String charset)
HttpResponsecharset 在接口中 HttpResponsepublic void addCookie(HttpCookie httpCookie)
HttpResponseaddCookie 在接口中 HttpResponsepublic List<String> getHeader(String name)
HttpResponsegetHeader 在接口中 HttpResponsepublic void addHeader(String name, String value)
HttpResponseaddHeader 在接口中 HttpResponsepublic void setHeader(String name, String value)
HttpResponsesetHeader 在接口中 HttpResponsepublic String getCharset()
HttpResponsegetCharset 在接口中 HttpResponsepublic void setCharset(String charset)
HttpResponsesetCharset 在接口中 HttpResponsepublic void setCharset(Charset charset)
HttpResponsesetCharset 在接口中 HttpResponsepublic void setContentLength(long contentLength)
HttpResponsesetContentLength 在接口中 HttpResponsepublic String getContentType()
HttpResponsegetContentType 在接口中 HttpResponsepublic void setContentType(String contentType)
HttpResponsesetContentType 在接口中 HttpResponsepublic String getContentDisposition()
HttpResponsegetContentDisposition 在接口中 HttpResponsepublic void setContentDisposition(String fileName)
HttpResponsesetContentDisposition 在接口中 HttpResponsepublic void acceptRanges(boolean acceptRanges)
HttpResponseacceptRanges 在接口中 HttpResponsepublic void redirect(String url)
HttpResponseredirect 在接口中 HttpResponseurl - 重定向地址public void streamingBody(String data) throws IOException
HttpResponsestreamingBody 在接口中 HttpResponseIOExceptionpublic void streamingBodyLine(String data) throws IOException
HttpResponsestreamingBodyLine 在接口中 HttpResponseIOExceptionpublic void eventSource(EventSource eventSource) throws IOException
HttpResponseeventSource 在接口中 HttpResponseeventSource - 推送事件IOExceptionpublic void download(String filePath) throws IOException
HttpResponsedownload 在接口中 HttpResponsefilePath - 文件路径IOExceptionpublic OutputStream getOutputStream() throws IOException
HttpResponsegetOutputStream 在接口中 HttpResponseIOExceptionpublic void httpStatus(HttpStatus httpStatus)
public void fillHeadStream()
throws IOException
IOExceptionCopyright © 2022. All rights reserved.