public class Response extends Object implements HttpResponse
| 构造器和说明 |
|---|
Response() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addCookie(Cookie cookie)
添加Cookie
|
File |
getFile() |
String |
getFileName() |
Map<String,String> |
getHeaders() |
io.netty.handler.codec.http.HttpResponseStatus |
getHttpResponseStatus() |
InputStream |
getInputStream() |
String |
getResult() |
boolean |
hasData()
Response 是否组装得有数据?
|
boolean |
isDownload() |
boolean |
isProxy() |
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 |
sendNull()
设置一个空字符
|
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 |
setResult(String result) |
public boolean hasData()
HttpResponsehasData 在接口中 HttpResponsepublic void setHeader(String key, String value)
setHeader 在接口中 HttpResponsekey - value - public void setDownloadFile(File file)
setDownloadFile 在接口中 HttpResponsefile - public void setDownloadBigFile(File file, ProgressStatus progressStatus, io.netty.channel.ChannelHandlerContext ctx) throws Exception
setDownloadBigFile 在接口中 HttpResponsefile - Exceptionpublic void setDownloadFile(InputStream inputStream, String fileName)
setDownloadFile 在接口中 HttpResponseinputStream - public void sendJsonString(String jsonStr)
HttpResponsesendJsonString 在接口中 HttpResponsepublic void sendJson(Object object)
HttpResponsesendJson 在接口中 HttpResponsepublic void sendHtml(String html)
HttpResponsesendHtml 在接口中 HttpResponsepublic void sendText(String text)
HttpResponsesendText 在接口中 HttpResponsepublic void sendNull()
public void sendStatusCode(io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus)
HttpResponsesendStatusCode 在接口中 HttpResponsepublic void isProxy(boolean p)
HttpResponseisProxy 在接口中 HttpResponsepublic void sendTemplate(String htmlPath, Map<String,Object> obj)
HttpResponsesendTemplate 在接口中 HttpResponsepublic void sendTemplate(String htmlPath)
HttpResponsesendTemplate 在接口中 HttpResponsepublic void addCookie(Cookie cookie)
addCookie 在接口中 HttpResponsecookie - public void redirect(String url)
HttpResponseredirect 在接口中 HttpResponsepublic File getFile()
public InputStream getInputStream()
public boolean isDownload()
public String getFileName()
public String getResult()
public void setResult(String result)
public io.netty.handler.codec.http.HttpResponseStatus getHttpResponseStatus()
public boolean isProxy()
Copyright © 2022. All rights reserved.