Interface Response

  • All Known Implementing Classes:
    ResponseImpl

    public interface Response
    Response class represents responses which are received by page.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.String> allHeaders()
      An object with all the response HTTP headers associated with this response.
      byte[] body()
      Returns the buffer with response body.
      java.lang.String finished()
      Waits for this response to finish, returns always null.
      Frame frame()
      Returns the Frame that initiated this response.
      boolean fromServiceWorker()
      Indicates whether this Response was fulfilled by a Service Worker's Fetch Handler (i.e.
      java.util.Map<java.lang.String,​java.lang.String> headers()
      An object with the response HTTP headers.
      java.util.List<HttpHeader> headersArray()
      An array with all the request HTTP headers associated with this response.
      java.lang.String headerValue​(java.lang.String name)
      Returns the value of the header matching the name.
      java.util.List<java.lang.String> headerValues​(java.lang.String name)
      Returns all values of the headers matching the name, for example set-cookie.
      boolean ok()
      Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
      Request request()
      Returns the matching Request object.
      SecurityDetails securityDetails()
      Returns SSL and other security information.
      ServerAddr serverAddr()
      Returns the IP address and port of the server.
      int status()
      Contains the status code of the response (e.g., 200 for a success).
      java.lang.String statusText()
      Contains the status text of the response (e.g.
      java.lang.String text()
      Returns the text representation of response body.
      java.lang.String url()
      Contains the URL of the response.
    • Method Detail

      • allHeaders

        java.util.Map<java.lang.String,​java.lang.String> allHeaders()
        An object with all the response HTTP headers associated with this response.
        Since:
        v1.15
      • body

        byte[] body()
        Returns the buffer with response body.
        Since:
        v1.8
      • finished

        java.lang.String finished()
        Waits for this response to finish, returns always null.
        Since:
        v1.8
      • frame

        Frame frame()
        Returns the Frame that initiated this response.
        Since:
        v1.8
      • fromServiceWorker

        boolean fromServiceWorker()
        Indicates whether this Response was fulfilled by a Service Worker's Fetch Handler (i.e. via FetchEvent.respondWith).
        Since:
        v1.23
      • headers

        java.util.Map<java.lang.String,​java.lang.String> headers()
        An object with the response HTTP headers. The header names are lower-cased. Note that this method does not return security-related headers, including cookie-related ones. You can use Response.allHeaders() for complete list of headers that include cookie information.
        Since:
        v1.8
      • headersArray

        java.util.List<HttpHeader> headersArray()
        An array with all the request HTTP headers associated with this response. Unlike Response.allHeaders(), header names are NOT lower-cased. Headers with multiple entries, such as Set-Cookie, appear in the array multiple times.
        Since:
        v1.15
      • headerValue

        java.lang.String headerValue​(java.lang.String name)
        Returns the value of the header matching the name. The name is case insensitive. If multiple headers have the same name (except set-cookie), they are returned as a list separated by , . For set-cookie, the \n separator is used. If no headers are found, null is returned.
        Parameters:
        name - Name of the header.
        Since:
        v1.15
      • headerValues

        java.util.List<java.lang.String> headerValues​(java.lang.String name)
        Returns all values of the headers matching the name, for example set-cookie. The name is case insensitive.
        Parameters:
        name - Name of the header.
        Since:
        v1.15
      • ok

        boolean ok()
        Contains a boolean stating whether the response was successful (status in the range 200-299) or not.
        Since:
        v1.8
      • request

        Request request()
        Returns the matching Request object.
        Since:
        v1.8
      • securityDetails

        SecurityDetails securityDetails()
        Returns SSL and other security information.
        Since:
        v1.13
      • serverAddr

        ServerAddr serverAddr()
        Returns the IP address and port of the server.
        Since:
        v1.13
      • status

        int status()
        Contains the status code of the response (e.g., 200 for a success).
        Since:
        v1.8
      • statusText

        java.lang.String statusText()
        Contains the status text of the response (e.g. usually an "OK" for a success).
        Since:
        v1.8
      • text

        java.lang.String text()
        Returns the text representation of response body.
        Since:
        v1.8
      • url

        java.lang.String url()
        Contains the URL of the response.
        Since:
        v1.8