public interface HttpResponse
Modifier and Type | Method and Description |
---|---|
void |
addCookie(HttpCookie cookie)
Add a cookie object to the message.
|
void |
addHeader(java.lang.String name,
java.lang.String value)
Append a header on the message using the provided name and value pair.
|
HttpOutputStream |
getBody()
Access the output stream representation of the body for this message.
|
long |
getContentLength()
Query the current content-length header of the message.
|
HttpCookie |
getCookie(java.lang.String name)
Access the first instance of a cookie with the provided name.
|
java.util.List<HttpCookie> |
getCookies()
Access a list of all cookies found in this message.
|
java.util.List<HttpCookie> |
getCookies(java.lang.String name)
Access a list of all cookie instances matching the provided name.
|
java.lang.String |
getHeader(java.lang.String name)
Access the value associated with the first instance of the target header
name.
|
java.util.List<java.lang.String> |
getHeaderNames()
Access a list of all header names found in this message.
|
java.util.List<java.lang.String> |
getHeaders()
Access a list of all header values in this message.
|
java.util.List<java.lang.String> |
getHeaders(java.lang.String name)
Access a list of all header values for a given header name.
|
java.lang.String |
getReason()
Query the current reason phrase of this message.
|
int |
getStatus()
Query the current status code of this message.
|
java.lang.String |
getVersion()
Query the current HTTP version of this message.
|
boolean |
isCommitted()
Check whether the response headers have been committed and sent out on
the network or not.
|
boolean |
isPersistent()
Check whether the connection is persistent or not.
|
void |
removeAllHeaders()
Remove all headers and cookies from the message.
|
void |
removeCookie(HttpCookie cookie)
Remove a cookie object from the message.
|
void |
removeHeader(java.lang.String name)
Remove the target header from the message.
|
void |
reset()
Resets the status code, version, and headers.
|
void |
setContentLength(long length)
Set the content-length header of this message.
|
void |
setHeader(java.lang.String name,
java.lang.String value)
Set a header on the message using the provided name and value pair.
|
void |
setReason(java.lang.String phrase)
Set the reason phrase to the input value.
|
void |
setStatus(int code)
Set the status code to the input value.
|
void |
setTrailer(java.lang.String name,
java.lang.String value)
Sets a trailer header to follow the body of this message
|
void |
setVersion(java.lang.String version)
Set the HTTP version of this message to the input value.
|
void |
writeTrailers()
Write trailer when all have been set.
|
void setStatus(int code)
code
- void setReason(java.lang.String phrase)
phrase
- void setVersion(java.lang.String version)
version
- void setContentLength(long length)
length
- void setHeader(java.lang.String name, java.lang.String value)
name
- value
- addHeader(String, String)
void addHeader(java.lang.String name, java.lang.String value)
name
- value
- setHeader(String, String)
void addCookie(HttpCookie cookie)
cookie
- void removeCookie(HttpCookie cookie)
cookie
- void removeHeader(java.lang.String name)
name
- void removeAllHeaders()
boolean isCommitted()
boolean isPersistent()
void reset()
int getStatus()
java.lang.String getReason()
java.lang.String getVersion()
long getContentLength()
java.lang.String getHeader(java.lang.String name)
name
- java.util.List<java.lang.String> getHeaders(java.lang.String name)
name
- java.util.List<java.lang.String> getHeaders()
java.util.List<java.lang.String> getHeaderNames()
HttpCookie getCookie(java.lang.String name)
name
- java.util.List<HttpCookie> getCookies(java.lang.String name)
name
- java.util.List<HttpCookie> getCookies()
HttpOutputStream getBody()
void setTrailer(java.lang.String name, java.lang.String value)
name
- value
- void writeTrailers()
name
- value
-