Package com.ibm.wsspi.http
Interface HttpResponse
public interface HttpResponse
Representation of an HTTP response message provided by the dispatcher to any
HTTP container.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCookie
(HttpCookie cookie) Add a cookie object to the message.void
Append a header on the message using the provided name and value pair.getBody()
Access the output stream representation of the body for this message.long
Query the current content-length header of the message.Access the first instance of a cookie with the provided name.Access a list of all cookies found in this message.getCookies
(String name) Access a list of all cookie instances matching the provided name.Access the value associated with the first instance of the target header name.Access a list of all header names found in this message.Access a list of all header values in this message.getHeaders
(String name) Access a list of all header values for a given header name.Query the current reason phrase of this message.int
Query the current status code of this message.Query the current HTTP version of this message.boolean
Check whether the response headers have been committed and sent out on the network or not.boolean
Check whether the connection is persistent or not.void
Remove all headers and cookies from the message.void
removeCookie
(HttpCookie cookie) Remove a cookie object from the message.void
removeHeader
(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
Set a header on the message using the provided name and value pair.void
Set the reason phrase to the input value.void
setStatus
(int code) Set the status code to the input value.void
setTrailer
(String name, String value) Sets a trailer header to follow the body of this messagevoid
setVersion
(String version) Set the HTTP version of this message to the input value.void
Write trailer when all have been set.
-
Method Details
-
setStatus
void setStatus(int code) Set the status code to the input value.- Parameters:
code
-
-
setReason
Set the reason phrase to the input value.- Parameters:
phrase
-
-
setVersion
Set the HTTP version of this message to the input value. This is expected to be of the form "HTTP/. ". - Parameters:
version
-
-
setContentLength
void setContentLength(long length) Set the content-length header of this message.- Parameters:
length
-
-
setHeader
Set a header on the message using the provided name and value pair. This will replace any currently existing instances of the header name.- Parameters:
name
-value
-- See Also:
-
addHeader
Append a header on the message using the provided name and value pair. This will be added to any current instance of the header name.- Parameters:
name
-value
-- See Also:
-
addCookie
Add a cookie object to the message.- Parameters:
cookie
-
-
removeCookie
Remove a cookie object from the message.- Parameters:
cookie
-
-
removeHeader
Remove the target header from the message.- Parameters:
name
-
-
removeAllHeaders
void removeAllHeaders()Remove all headers and cookies from the message. -
isCommitted
boolean isCommitted()Check whether the response headers have been committed and sent out on the network or not.- Returns:
- boolean
-
isPersistent
boolean isPersistent()Check whether the connection is persistent or not.- Returns:
- boolean
-
reset
void reset()Resets the status code, version, and headers. -
getStatus
int getStatus()Query the current status code of this message.- Returns:
- int
-
getReason
String getReason()Query the current reason phrase of this message.- Returns:
- String
-
getVersion
String getVersion()Query the current HTTP version of this message. It will be in the form of "HTTP/. ". - Returns:
- String
-
getContentLength
long getContentLength()Query the current content-length header of the message. This will be -1L if the header is not set.- Returns:
- long
-
getHeader
Access the value associated with the first instance of the target header name. This will return null if no instance was found.- Parameters:
name
-- Returns:
- String
-
getHeaders
Access a list of all header values for a given header name. This list is never null, but might be empty.- Parameters:
name
-- Returns:
- List
-
getHeaders
Access a list of all header values in this message. This list is never null, but might be empty.- Returns:
- List
-
getHeaderNames
Access a list of all header names found in this message. This list is never null, but might be empty.- Returns:
- List
-
getCookie
Access the first instance of a cookie with the provided name. This might be null if no match is found.- Parameters:
name
-- Returns:
- HttpCookie
-
getCookies
Access a list of all cookie instances matching the provided name. This list is never null, but might be empty.- Parameters:
name
-- Returns:
- List
-
getCookies
List<HttpCookie> getCookies()Access a list of all cookies found in this message. The list is never null, but might be empty.- Returns:
- List
-
getBody
HttpOutputStream getBody()Access the output stream representation of the body for this message.- Returns:
- HttpOutputStream
-
setTrailer
Sets a trailer header to follow the body of this message- Parameters:
name
-value
-
-
writeTrailers
void writeTrailers()Write trailer when all have been set.- Parameters:
name
-value
-
-