public class HttpResponse extends HttpPacket
headers
Constructor and Description |
---|
HttpResponse(HttpRequest request,
HttpConfig httpConfig) |
Modifier and Type | Method and Description |
---|---|
boolean |
addCookie(Cookie cookie) |
String |
getCharset() |
List<Cookie> |
getCookies() |
byte[] |
getEncodedBytes() |
HttpRequest |
getHttpRequestPacket() |
HttpResponseStatus |
getStatus() |
boolean |
isStaticRes() |
String |
logstr() |
static void |
main(String[] args) |
void |
setBody(byte[] body,
HttpRequest request) |
void |
setBodyAndGzip(byte[] body,
HttpRequest request) |
void |
setCharset(String charset) |
void |
setCookies(List<Cookie> cookies) |
void |
setEncodedBytes(byte[] encodedBytes) |
void |
setHttpRequestPacket(HttpRequest request) |
void |
setStaticRes(boolean isStaticRes) |
void |
setStatus(HttpResponseStatus status) |
addHeader, addHeaders, getHeader, getHeaders, getHeaderString, removeHeader, setHeaders, setHeaderString
calcHeaderLength, decode4ByteLength, decodeCompress, decodeHasSynSeq, decodeVersion, encode4ByteLength, encodeCompress, encodeEncrypt, encodeHasSynSeq, getBody, getCommand, isFromCluster, setBody, setCommand, setFromCluster, setStatus
clone, getByteCount, getId, getMeta, getPacketListener, getPreEncodedByteBuffer, getRespId, getSynSeq, isBlockSend, isSslEncrypted, setBlockSend, setByteCount, setId, setMeta, setPacketListener, setPreEncodedByteBuffer, setRespId, setSslEncrypted, setSynSeq
public HttpResponse(HttpRequest request, HttpConfig httpConfig)
request
- httpConfig
- 可以为nullpublic static void main(String[] args)
args
- public boolean addCookie(Cookie cookie)
public String getCharset()
public byte[] getEncodedBytes()
public HttpRequest getHttpRequestPacket()
public HttpResponseStatus getStatus()
public boolean isStaticRes()
public void setBody(byte[] body, HttpRequest request)
public void setBodyAndGzip(byte[] body, HttpRequest request)
body
- the body to setpublic void setCharset(String charset)
charset
- the charset to setpublic void setEncodedBytes(byte[] encodedBytes)
encodedBytes
- the encodedBytes to setpublic void setHttpRequestPacket(HttpRequest request)
request
- the request to setpublic void setStaticRes(boolean isStaticRes)
isStaticRes
- the isStaticRes to setpublic void setStatus(HttpResponseStatus status)
status
- the status to setCopyright © 2018. All rights reserved.