Package org.jsoup

Interface Connection.Base<T extends Connection.Base>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String cookie​(java.lang.String name)
      Get a cookie value by name from this request/response.
      T cookie​(java.lang.String name, java.lang.String value)
      Set a cookie in this request/response.
      java.util.Map<java.lang.String,​java.lang.String> cookies()
      Retrieve all of the request/response cookies as a map
      boolean hasCookie​(java.lang.String name)
      Check if a cookie is present
      boolean hasHeader​(java.lang.String name)
      Check if a header is present
      boolean hasHeaderWithValue​(java.lang.String name, java.lang.String value)
      Check if a header is present, with the given value
      java.lang.String header​(java.lang.String name)
      Get the value of a header.
      T header​(java.lang.String name, java.lang.String value)
      Set a header.
      java.util.Map<java.lang.String,​java.lang.String> headers()
      Retrieve all of the request/response headers as a map
      Connection.Method method()
      Get the request method
      T method​(Connection.Method method)
      Set the request method
      T removeCookie​(java.lang.String name)
      Remove a cookie by name
      T removeHeader​(java.lang.String name)
      Remove a header by name
      java.net.URL url()
      Get the URL
      T url​(java.net.URL url)
      Set the URL
    • Method Detail

      • url

        java.net.URL url()
        Get the URL
        Returns:
        URL
      • url

        T url​(java.net.URL url)
        Set the URL
        Parameters:
        url - new URL
        Returns:
        this, for chaining
      • method

        T method​(Connection.Method method)
        Set the request method
        Parameters:
        method - new method
        Returns:
        this, for chaining
      • header

        java.lang.String header​(java.lang.String name)
        Get the value of a header. This is a simplified header model, where a header may only have one value.

        Header names are case insensitive.

        Parameters:
        name - name of header (case insensitive)
        Returns:
        value of header, or null if not set.
        See Also:
        hasHeader(String), cookie(String)
      • header

        T header​(java.lang.String name,
                 java.lang.String value)
        Set a header. This method will overwrite any existing header with the same case insensitive name.
        Parameters:
        name - Name of header
        value - Value of header
        Returns:
        this, for chaining
      • hasHeader

        boolean hasHeader​(java.lang.String name)
        Check if a header is present
        Parameters:
        name - name of header (case insensitive)
        Returns:
        if the header is present in this request/response
      • hasHeaderWithValue

        boolean hasHeaderWithValue​(java.lang.String name,
                                   java.lang.String value)
        Check if a header is present, with the given value
        Parameters:
        name - header name (case insensitive)
        value - value (case insensitive)
        Returns:
        if the header and value pair are set in this req/res
      • removeHeader

        T removeHeader​(java.lang.String name)
        Remove a header by name
        Parameters:
        name - name of header to remove (case insensitive)
        Returns:
        this, for chaining
      • headers

        java.util.Map<java.lang.String,​java.lang.String> headers()
        Retrieve all of the request/response headers as a map
        Returns:
        headers
      • cookie

        java.lang.String cookie​(java.lang.String name)
        Get a cookie value by name from this request/response.

        Response objects have a simplified cookie model. Each cookie set in the response is added to the response object's cookie key=value map. The cookie's path, domain, and expiry date are ignored.

        Parameters:
        name - name of cookie to retrieve.
        Returns:
        value of cookie, or null if not set
      • cookie

        T cookie​(java.lang.String name,
                 java.lang.String value)
        Set a cookie in this request/response.
        Parameters:
        name - name of cookie
        value - value of cookie
        Returns:
        this, for chaining
      • hasCookie

        boolean hasCookie​(java.lang.String name)
        Check if a cookie is present
        Parameters:
        name - name of cookie
        Returns:
        if the cookie is present in this request/response
      • removeCookie

        T removeCookie​(java.lang.String name)
        Remove a cookie by name
        Parameters:
        name - name of cookie to remove
        Returns:
        this, for chaining
      • cookies

        java.util.Map<java.lang.String,​java.lang.String> cookies()
        Retrieve all of the request/response cookies as a map
        Returns:
        cookies