Class HttpConnection.Request

    • Field Detail

      • proxy

        private java.net.Proxy proxy
      • timeoutMilliseconds

        private int timeoutMilliseconds
      • maxBodySizeBytes

        private int maxBodySizeBytes
      • followRedirects

        private boolean followRedirects
      • body

        private java.lang.String body
      • ignoreHttpErrors

        private boolean ignoreHttpErrors
      • ignoreContentType

        private boolean ignoreContentType
      • parser

        private Parser parser
      • parserDefined

        private boolean parserDefined
      • postDataCharset

        private java.lang.String postDataCharset
      • sslSocketFactory

        private javax.net.ssl.SSLSocketFactory sslSocketFactory
    • Constructor Detail

      • Request

        Request()
    • Method Detail

      • proxy

        public java.net.Proxy proxy()
        Description copied from interface: Connection.Request
        Get the proxy used for this request.
        Specified by:
        proxy in interface Connection.Request
        Returns:
        the proxy; null if not enabled.
      • proxy

        public HttpConnection.Request proxy​(java.lang.String host,
                                            int port)
        Description copied from interface: Connection.Request
        Set the HTTP proxy to use for this request.
        Specified by:
        proxy in interface Connection.Request
        Parameters:
        host - the proxy hostname
        port - the proxy port
        Returns:
        this Connection, for chaining
      • timeout

        public int timeout()
        Description copied from interface: Connection.Request
        Get the request timeout, in milliseconds.
        Specified by:
        timeout in interface Connection.Request
        Returns:
        the timeout in milliseconds.
      • followRedirects

        public boolean followRedirects()
        Description copied from interface: Connection.Request
        Get the current followRedirects configuration.
        Specified by:
        followRedirects in interface Connection.Request
        Returns:
        true if followRedirects is enabled.
      • followRedirects

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

        public boolean ignoreHttpErrors()
        Description copied from interface: Connection.Request
        Get the current ignoreHttpErrors configuration.
        Specified by:
        ignoreHttpErrors in interface Connection.Request
        Returns:
        true if errors will be ignored; false (default) if HTTP errors will cause an IOException to be thrown.
      • sslSocketFactory

        public javax.net.ssl.SSLSocketFactory sslSocketFactory()
        Description copied from interface: Connection.Request
        Get the current custom SSL socket factory, if any.
        Specified by:
        sslSocketFactory in interface Connection.Request
        Returns:
        custom SSL socket factory if set, null otherwise
      • sslSocketFactory

        public void sslSocketFactory​(javax.net.ssl.SSLSocketFactory sslSocketFactory)
        Description copied from interface: Connection.Request
        Set a custom SSL socket factory.
        Specified by:
        sslSocketFactory in interface Connection.Request
        Parameters:
        sslSocketFactory - SSL socket factory
      • ignoreHttpErrors

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

        public boolean ignoreContentType()
        Description copied from interface: Connection.Request
        Get the current ignoreContentType configuration.
        Specified by:
        ignoreContentType in interface Connection.Request
        Returns:
        true if invalid content-types will be ignored; false (default) if they will cause an IOException to be thrown.
      • ignoreContentType

        public Connection.Request ignoreContentType​(boolean ignoreContentType)
        Description copied from interface: Connection.Request
        Configures the request to ignore the Content-Type of the response.
        Specified by:
        ignoreContentType in interface Connection.Request
        Parameters:
        ignoreContentType - set to true to ignore the content type.
        Returns:
        this Request, for chaining
      • requestBody

        public Connection.Request requestBody​(java.lang.String body)
        Description copied from interface: Connection.Request
        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.
        Specified by:
        requestBody in interface Connection.Request
        Returns:
        this Request, for chaining
      • postDataCharset

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

        public java.lang.String postDataCharset()
        Description copied from interface: Connection.Request
        Gets the post data character set for x-www-form-urlencoded post data
        Specified by:
        postDataCharset in interface Connection.Request
        Returns:
        character set to encode post data