public class WebSocketResponseImpl extends Object implements WebSocketResponse
| 构造器和说明 |
|---|
WebSocketResponseImpl(WebSocketRequestImpl webSocketRequest) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addCookie(Cookie cookie)
添加Cookie信息
|
void |
addHeader(String name,
String value)
Adds a response header with the given name and value.
|
void |
close()
关闭ws通道
|
void |
close(int code,
String reason) |
void |
flush()
输出数据
|
int |
getContentLength() |
String |
getContentType() |
List<Cookie> |
getCookies() |
String |
getHeader(String name) |
Collection<String> |
getHeaderNames()
Get the header names set for this HTTP response.
|
Collection<String> |
getHeaders(String name)
Return a Collection of all the header values associated with the
specified header name.
|
int |
getHttpStatus()
获取Http响应状态
|
org.smartboot.http.server.impl.AbstractOutputStream |
getOutputStream()
响应消息输出流
|
String |
getReasonPhrase()
获取Http响应描述
|
boolean |
isClosed()
是否要断开TCP连接
|
boolean |
isDefaultStatus() |
void |
ping(byte[] bytes) |
void |
pong(byte[] bytes) |
void |
reset() |
void |
sendBinaryMessage(byte[] bytes)
发送二进制响应
|
void |
sendBinaryMessage(byte[] bytes,
int offset,
int length)
发送二进制响应
|
void |
sendTextMessage(String text)
发送文本响应
|
void |
setContentLength(int contentLength) |
void |
setContentType(String contentType) |
void |
setHeader(String name,
String value)
Sets a response header with the given name and value.
|
void |
setHttpStatus(HttpStatus httpStatus)
设置Http响应状态,若不设置默认
HttpStatus.OK |
void |
setHttpStatus(int value,
String reasonPhrase)
设置Http响应状态,若不设置默认
HttpStatus.OK |
void |
write(byte[] buffer) |
ping, pongpublic WebSocketResponseImpl(WebSocketRequestImpl webSocketRequest)
public void sendTextMessage(String text)
WebSocketResponsesendTextMessage 在接口中 WebSocketResponsepublic void sendBinaryMessage(byte[] bytes)
WebSocketResponsesendBinaryMessage 在接口中 WebSocketResponsepublic void sendBinaryMessage(byte[] bytes,
int offset,
int length)
WebSocketResponsesendBinaryMessage 在接口中 WebSocketResponsepublic void pong(byte[] bytes)
pong 在接口中 WebSocketResponsepublic void close()
WebSocketResponseclose 在接口中 HttpResponseclose 在接口中 WebSocketResponsepublic void close(int code,
String reason)
close 在接口中 WebSocketResponsepublic void ping(byte[] bytes)
ping 在接口中 WebSocketResponsepublic void flush()
WebSocketResponseflush 在接口中 WebSocketResponsepublic final org.smartboot.http.server.impl.AbstractOutputStream getOutputStream()
HttpResponsegetOutputStream 在接口中 HttpResponsepublic int getHttpStatus()
HttpResponsegetHttpStatus 在接口中 HttpResponsepublic final void setHttpStatus(HttpStatus httpStatus)
HttpResponseHttpStatus.OKsetHttpStatus 在接口中 HttpResponsepublic String getReasonPhrase()
HttpResponsegetReasonPhrase 在接口中 HttpResponsepublic final void setHttpStatus(int value,
String reasonPhrase)
HttpResponseHttpStatus.OKsetHttpStatus 在接口中 HttpResponsepublic boolean isDefaultStatus()
public final void setHeader(String name, String value)
HttpResponsecontainsHeader method can be used to test for the presence
of a header before setting its value.setHeader 在接口中 HttpResponsename - the name of the headervalue - the header value If it contains octet string, it should be
encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt)HttpResponse.addHeader(java.lang.String, java.lang.String)public final void addHeader(String name, String value)
HttpResponseaddHeader 在接口中 HttpResponsename - the name of the headervalue - the additional header value If it contains octet string, it
should be encoded according to RFC 2047
(http://www.ietf.org/rfc/rfc2047.txt)HttpResponse.setHeader(java.lang.String, java.lang.String)public final String getHeader(String name)
getHeader 在接口中 HttpResponsepublic final Collection<String> getHeaders(String name)
HttpResponsegetHeaders 在接口中 HttpResponsename - Header name to look uppublic final Collection<String> getHeaderNames()
HttpResponsegetHeaderNames 在接口中 HttpResponsepublic final void write(byte[] buffer)
throws IOException
write 在接口中 HttpResponseIOExceptionpublic void addCookie(Cookie cookie)
HttpResponseaddCookie 在接口中 HttpResponsepublic int getContentLength()
getContentLength 在接口中 HttpResponsepublic void setContentLength(int contentLength)
setContentLength 在接口中 HttpResponsepublic final String getContentType()
getContentType 在接口中 HttpResponsepublic final void setContentType(String contentType)
setContentType 在接口中 HttpResponsepublic final boolean isClosed()
Copyright © 2024. All rights reserved.