Package org.openqa.selenium.remote.http
Class HttpResponse
java.lang.Object
org.openqa.selenium.remote.http.HttpResponse
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a header with thenameandvalue, headers with the same (case-insensitive) name will be preserved.voidforEachHeader(BiConsumer<String, String> action) Calls theactionfor 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).intReturns the host this response was received from, or null if it was not set.booleanremoveAttribute(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 theactionfor 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 thenameandvalue, 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
-