Package org.openqa.selenium.remote.http
Class HttpResponse
java.lang.Object
org.openqa.selenium.remote.http.HttpResponse
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a header with thename
andvalue
, headers with the same (case-insensitive) name will be preserved.void
forEachHeader
(BiConsumer<String, String> action) Calls theaction
for all headers set.getAttribute
(String key) Retrieves a user-defined attribute of this message.Returns the value of the first header with thename
(case-insensitive).Returns an iterable with all the names of the headers set.getHeaders
(String name) Returns an iterable of the values of headers with thename
(case-insensitive).int
Returns the host this response was received from, or null if it was not set.boolean
removeAttribute
(String key) removeHeader
(String name) Removes all headers with thename
(case-insensitive).setAttribute
(String key, Object value) setContent
(Supplier<InputStream> supplier) Deprecated.setContent
(Contents.Supplier supplier) Removes all headers with thename
(case-insensitive) and adds a header with thevalue
.setStatus
(int status) setTargetHost
(String host) Sets the host this response was received from.toString()
-
Field Details
-
HTTP_TARGET_HOST
- See Also:
-
-
Constructor Details
-
HttpResponse
public HttpResponse()
-
-
Method Details
-
isSuccessful
public boolean isSuccessful() -
getStatus
public int getStatus() -
setStatus
-
setTargetHost
Sets the host this response was received from.- Parameters:
host
- originating host
-
getTargetHost
Returns the host this response was received from, or null if it was not set.- Returns:
- originating host
-
toString
-
getAttribute
Retrieves a user-defined attribute of this message. Attributes are stored as simple key-value pairs and are not included in a message's serialized form.- Parameters:
key
- attribute name- Returns:
- attribute object
-
setAttribute
-
removeAttribute
-
getAttributeNames
-
forEachHeader
Calls theaction
for all headers set.- Parameters:
action
- the action to call
-
getHeaderNames
Returns an iterable with all the names of the headers set.- Returns:
- an iterable view of the header names
-
getHeaders
Returns an iterable of the values of headers with thename
(case-insensitive).- Parameters:
name
- the name of the header, case-insensitive- Returns:
- an iterable view of the values
-
getHeader
Returns the value of the first header with thename
(case-insensitive).- Parameters:
name
- the name of the header, case-insensitive- Returns:
- the value
-
setHeader
Removes all headers with thename
(case-insensitive) and adds a header with thevalue
.- Parameters:
name
- the name of the header, case-insensitivevalue
- the value to set- Returns:
- self
-
addHeader
Adds a header with thename
andvalue
, headers with the same (case-insensitive) name will be preserved.- Parameters:
name
- the name of the header, case-insensitivevalue
- the value to set- Returns:
- self
-
removeHeader
Removes all headers with thename
(case-insensitive).- Parameters:
name
- the name of the header, case-insensitive- Returns:
- self
-
getContentEncoding
-
setContent
Deprecated. -
setContent
-
getContent
-