public class HttpServletResponse extends Object
| 构造器和说明 |
|---|
HttpServletResponse(Socket socket) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addHeader(String key,
Object value)
添加响应头的参数
|
File |
getContentFile() |
OutputStream |
getOutputStream() |
int |
getStatusCode() |
String |
getStatusReason() |
PrintWriter |
getWriter() |
void |
response()
将当前响应对象内容以标准的HTTP响应格式,发送给客户端(浏览器)
|
void |
sendRedirect(String path)
路由重定向
|
void |
setContentFile(File contentFile) |
void |
setContentType(String mime)
通过返回的字节输出流写出的字节最终会作为响应正文内容发送给客户端
|
void |
setStatusCode(int statusCode) |
void |
setStatusReason(String statusReason) |
public HttpServletResponse(Socket socket)
public void response()
throws IOException
IOExceptionpublic void sendRedirect(String path)
public void setContentFile(File contentFile) throws IOException
IOExceptionpublic OutputStream getOutputStream()
public PrintWriter getWriter()
public void setContentType(String mime)
public int getStatusCode()
public void setStatusCode(int statusCode)
public String getStatusReason()
public void setStatusReason(String statusReason)
public File getContentFile()
Copyright © 2023. All rights reserved.