Package org.jsoup

Interface Connection.Request

    • Method Detail

      • proxy

        java.net.Proxy proxy()
        Get the proxy used for this request.
        Returns:
        the proxy; null if not enabled.
      • proxy

        Connection.Request proxy​(java.net.Proxy proxy)
        Update the proxy for this request.
        Parameters:
        proxy - the proxy ot use; null to disable.
        Returns:
        this Request, for chaining
      • proxy

        Connection.Request proxy​(java.lang.String host,
                                 int port)
        Set the HTTP proxy to use for this request.
        Parameters:
        host - the proxy hostname
        port - the proxy port
        Returns:
        this Connection, for chaining
      • timeout

        int timeout()
        Get the request timeout, in milliseconds.
        Returns:
        the timeout in milliseconds.
      • timeout

        Connection.Request timeout​(int millis)
        Update the request timeout.
        Parameters:
        millis - timeout, in milliseconds
        Returns:
        this Request, for chaining
      • maxBodySize

        int maxBodySize()
        Get the maximum body size, in bytes.
        Returns:
        the maximum body size, in bytes.
      • maxBodySize

        Connection.Request maxBodySize​(int bytes)
        Update the maximum body size, in bytes.
        Parameters:
        bytes - maximum body size, in bytes.
        Returns:
        this Request, for chaining
      • followRedirects

        boolean followRedirects()
        Get the current followRedirects configuration.
        Returns:
        true if followRedirects is enabled.
      • followRedirects

        Connection.Request followRedirects​(boolean followRedirects)
        Configures the request to (not) follow server redirects. By default this is true.
        Parameters:
        followRedirects - true if server redirects should be followed.
        Returns:
        this Request, for chaining
      • ignoreHttpErrors

        boolean ignoreHttpErrors()
        Get the current ignoreHttpErrors configuration.
        Returns:
        true if errors will be ignored; false (default) if HTTP errors will cause an IOException to be thrown.
      • ignoreHttpErrors

        Connection.Request ignoreHttpErrors​(boolean ignoreHttpErrors)
        Configures the request to ignore HTTP errors in the response.
        Parameters:
        ignoreHttpErrors - set to true to ignore HTTP errors.
        Returns:
        this Request, for chaining
      • ignoreContentType

        boolean ignoreContentType()
        Get the current ignoreContentType configuration.
        Returns:
        true if invalid content-types will be ignored; false (default) if they will cause an IOException to be thrown.
      • ignoreContentType

        Connection.Request ignoreContentType​(boolean ignoreContentType)
        Configures the request to ignore the Content-Type of the response.
        Parameters:
        ignoreContentType - set to true to ignore the content type.
        Returns:
        this Request, for chaining
      • sslSocketFactory

        javax.net.ssl.SSLSocketFactory sslSocketFactory()
        Get the current custom SSL socket factory, if any.
        Returns:
        custom SSL socket factory if set, null otherwise
      • sslSocketFactory

        void sslSocketFactory​(javax.net.ssl.SSLSocketFactory sslSocketFactory)
        Set a custom SSL socket factory.
        Parameters:
        sslSocketFactory - SSL socket factory
      • data

        java.util.Collection<Connection.KeyVal> data()
        Get all of the request's data parameters
        Returns:
        collection of keyvals
      • requestBody

        Connection.Request requestBody​(java.lang.String body)
        Set a POST (or PUT) request body. Useful when a server expects a plain request body, not a set for URL encoded form key/value pairs. E.g.:
        Jsoup.connect(url)
         .requestBody(json)
         .header("Content-Type", "application/json")
         .post();
        If any data key/vals are supplied, they will be sent as URL query params.
        Returns:
        this Request, for chaining
      • requestBody

        java.lang.String requestBody()
        Get the current request body.
        Returns:
        null if not set.
      • parser

        Connection.Request parser​(Parser parser)
        Specify the parser to use when parsing the document.
        Parameters:
        parser - parser to use.
        Returns:
        this Request, for chaining
      • parser

        Parser parser()
        Get the current parser to use when parsing the document.
        Returns:
        current Parser
      • postDataCharset

        Connection.Request postDataCharset​(java.lang.String charset)
        Sets the post data character set for x-www-form-urlencoded post data
        Parameters:
        charset - character set to encode post data
        Returns:
        this Request, for chaining
      • postDataCharset

        java.lang.String postDataCharset()
        Gets the post data character set for x-www-form-urlencoded post data
        Returns:
        character set to encode post data