public interface HttpResponse
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addCookie(Cookie cookie)
添加Cookie
|
boolean |
hasData()
Response 是否组装得有数据?
|
void |
isProxy(boolean p)
设置为代理模式,就不输出数据了
|
void |
redirect(String url)
重定向
|
void |
sendHtml(String html)
发送HTML
|
void |
sendJson(Object object)
发送Object对象自动转json
|
void |
sendJsonString(String jsonStr)
发送String的字符串
|
void |
sendStatusCode(io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus)
设置状态码
|
void |
sendTemplate(String htmlPath)
Freemarker模板
|
void |
sendTemplate(String htmlPath,
Map<String,Object> obj)
Freemarker模板
|
void |
sendText(String text)
发送文本
|
void |
setDownloadBigFile(File file,
ProgressStatus progressStatus,
io.netty.channel.ChannelHandlerContext ctx)
下载大文件
|
void |
setDownloadFile(File file)
设置下载文件
|
void |
setDownloadFile(InputStream inputStream,
String fileName)
流的下载文件
|
void |
setHeader(String key,
String value)
设置请求头
|
void setDownloadFile(File file)
file - void setDownloadBigFile(File file, ProgressStatus progressStatus, io.netty.channel.ChannelHandlerContext ctx) throws Exception
file - progressStatus - ctx - Exceptionvoid setDownloadFile(InputStream inputStream, String fileName)
inputStream - fileName - void sendJson(Object object)
object - void sendJsonString(String jsonStr)
jsonStr - void sendHtml(String html)
html - void sendText(String text)
text - void sendTemplate(String htmlPath, Map<String,Object> obj)
htmlPath - obj - void sendTemplate(String htmlPath)
htmlPath - void addCookie(Cookie cookie)
cookie - void redirect(String url)
url - void sendStatusCode(io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus)
httpResponseStatus - boolean hasData()
void isProxy(boolean p)
p - Copyright © 2022. All rights reserved.