Class HttpResponse

java.lang.Object
org.openqa.selenium.remote.http.HttpResponse

public class HttpResponse extends Object
  • Field Details

  • Constructor Details

    • HttpResponse

      public HttpResponse()
  • Method Details

    • isSuccessful

      public boolean isSuccessful()
    • getStatus

      public int getStatus()
    • setStatus

      public HttpResponse setStatus(int status)
    • setTargetHost

      public HttpResponse setTargetHost(String host)
      Sets the host this response was received from.
      Parameters:
      host - originating host
    • getTargetHost

      public String getTargetHost()
      Returns the host this response was received from, or null if it was not set.
      Returns:
      originating host
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAttribute

      public Object getAttribute(String key)
      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

      public HttpResponse setAttribute(String key, Object value)
    • removeAttribute

      public HttpResponse removeAttribute(String key)
    • getAttributeNames

      public Iterable<String> getAttributeNames()
    • forEachHeader

      public void forEachHeader(BiConsumer<String,String> action)
      Calls the action for all headers set.
      Parameters:
      action - the action to call
    • getHeaderNames

      public Iterable<String> getHeaderNames()
      Returns an iterable with all the names of the headers set.
      Returns:
      an iterable view of the header names
    • getHeaders

      public Iterable<String> getHeaders(String name)
      Returns an iterable of the values of headers with the name (case-insensitive).
      Parameters:
      name - the name of the header, case-insensitive
      Returns:
      an iterable view of the values
    • getHeader

      public String getHeader(String name)
      Returns the value of the first header with the name (case-insensitive).
      Parameters:
      name - the name of the header, case-insensitive
      Returns:
      the value
    • setHeader

      public HttpResponse setHeader(String name, String value)
      Removes all headers with the name (case-insensitive) and adds a header with the value.
      Parameters:
      name - the name of the header, case-insensitive
      value - the value to set
      Returns:
      self
    • addHeader

      public HttpResponse addHeader(String name, String value)
      Adds a header with the name and value, headers with the same (case-insensitive) name will be preserved.
      Parameters:
      name - the name of the header, case-insensitive
      value - the value to set
      Returns:
      self
    • removeHeader

      public HttpResponse removeHeader(String name)
      Removes all headers with the name (case-insensitive).
      Parameters:
      name - the name of the header, case-insensitive
      Returns:
      self
    • getContentEncoding

      public Charset getContentEncoding()
    • setContent

      @Deprecated public HttpResponse setContent(Supplier<InputStream> supplier)
      Deprecated.
    • setContent

      public HttpResponse setContent(Contents.Supplier supplier)
    • getContent

      public Contents.Supplier getContent()