Java 类org.jsoup.helper.HttpConnection 实例源码

项目:J-Kinopoisk2IMDB    文件:MovieRatingChanger.java   
/**
 * Sends POST request and changes Movie rating,
 * using using {@link MovieAuthStringFetcher#getResponseProcessor()} authorization string
 * and {@link Movie#imdbId}
 *
 * @param movie Movie which rating to change
 * @throws IOException If an I/O error occurs
 */
@Override
public ExchangeObject<Integer> prepare(@NonNull Movie movie) throws IOException {
    val movieRatingChangeLink = new URL("http://www.imdb.com/ratings/_ajax/title");

    val postData = new ImmutableMap.Builder<String, String>()
            .put("tconst", movie.getImdbId())
            .put("rating", String.valueOf(movie.getRating()))
            .put("auth", authString)
            .put("pageId", movie.getImdbId())
            .put("tracking_tag", "title-maindetails")
            .put("pageType", "title")
            .put("subpageType", "main")
            .build();

    val request = HttpConnection.connect(movieRatingChangeLink)
            .method(Connection.Method.POST)
            .userAgent(config.getString("user_agent"))
            .timeout(config.getInt("timeout"))
            .cookie("id", config.getString("auth"))
            .ignoreContentType(true)
            .data(postData)
            .request();

    return new ExchangeObject<>(request, new JSONPOSTResponseProcessor());
}
项目:J-Kinopoisk2IMDB    文件:MovieWatchlistAssigner.java   
/**
 * Sends POST request and adds Movie to IMDB list, using {@link Movie#imdbId}
 *
 * @param movie Movie which should be added to IMDB list
 * @throws IOException If an I/O error occurs
 */
@Override
public ExchangeObject<Integer> prepare(@NonNull Movie movie) throws IOException {
    val movieAddToWatchlistLink = new URL("http://www.imdb.com/list/_ajax/edit");

    val postData = new ImmutableMap.Builder<String, String>()
            .put("const", movie.getImdbId())
            .put("list_id", config.getString("list"))
            .put("ref_tag", "title")
            .build();

    val request = HttpConnection.connect(movieAddToWatchlistLink)
            .method(Connection.Method.POST)
            .userAgent(config.getString("user_agent"))
            .timeout(config.getInt("timeout"))
            .cookie("id", config.getString("auth"))
            .ignoreContentType(true)
            .data(postData)
            .request();

    return new ExchangeObject<>(request, new JSONPOSTResponseProcessor());
}
项目:CN1ML-NetbeansModule    文件:FormElement.java   
/**
 * Get the data that this form submits. The returned list is a copy of the data, and changes to the contents of the
 * list will not be reflected in the DOM.
 * @return a list of key vals
 */
public List<Connection.KeyVal> formData() {
    ArrayList<Connection.KeyVal> data = new ArrayList<Connection.KeyVal>();

    // iterate the form control elements and accumulate their values
    for (Element el: elements) {
        if (!el.tag().isFormSubmittable()) continue; // contents are form listable, superset of submitable
        String name = el.attr("name");
        if (name.length() == 0) continue;

        if ("select".equals(el.tagName())) {
            Elements options = el.select("option[selected]");
            for (Element option: options) {
                data.add(HttpConnection.KeyVal.create(name, option.val()));
            }
        } else {
            data.add(HttpConnection.KeyVal.create(name, el.val()));
        }
    }
    return data;
}
项目:BoL-API-Parser    文件:FormElement.java   
/**
 * Get the data that this form submits. The returned list is a copy of the data, and changes to the contents of the
 * list will not be reflected in the DOM.
 * @return a list of key vals
 */
public List<Connection.KeyVal> formData() {
    ArrayList<Connection.KeyVal> data = new ArrayList<Connection.KeyVal>();

    // iterate the form control elements and accumulate their values
    for (Element el: elements) {
        if (!el.tag().isFormSubmittable()) continue; // contents are form listable, superset of submitable
        String name = el.attr("name");
        if (name.length() == 0) continue;

        if ("select".equals(el.tagName())) {
            Elements options = el.select("option[selected]");
            for (Element option: options) {
                data.add(HttpConnection.KeyVal.create(name, option.val()));
            }
        } else {
            data.add(HttpConnection.KeyVal.create(name, el.val()));
        }
    }
    return data;
}
项目:AngelList-Mobile    文件:FormElement.java   
/**
 * Get the data that this form submits. The returned list is a copy of the data, and changes to the contents of the
 * list will not be reflected in the DOM.
 * @return a list of key vals
 */
public List<Connection.KeyVal> formData() {
    ArrayList<Connection.KeyVal> data = new ArrayList<Connection.KeyVal>();

    // iterate the form control elements and accumulate their values
    for (Element el: elements) {
        if (!el.tag().isFormSubmittable()) continue; // contents are form listable, superset of submitable
        String name = el.attr("name");
        if (name.length() == 0) continue;

        if ("select".equals(el.tagName())) {
            Elements options = el.select("option[selected]");
            for (Element option: options) {
                data.add(HttpConnection.KeyVal.create(name, option.val()));
            }
        } else {
            data.add(HttpConnection.KeyVal.create(name, el.val()));
        }
    }
    return data;
}
项目:jsoup-learning    文件:FormElement.java   
/**
 * Get the data that this form submits. The returned list is a copy of the data, and changes to the contents of the
 * list will not be reflected in the DOM.
 * @return a list of key vals
 */
public List<Connection.KeyVal> formData() {
    ArrayList<Connection.KeyVal> data = new ArrayList<Connection.KeyVal>();

    // iterate the form control elements and accumulate their values
    for (Element el: elements) {
        if (!el.tag().isFormSubmittable()) continue; // contents are form listable, superset of submitable
        String name = el.attr("name");
        if (name.length() == 0) continue;

        if ("select".equals(el.tagName())) {
            Elements options = el.select("option[selected]");
            for (Element option: options) {
                data.add(HttpConnection.KeyVal.create(name, option.val()));
            }
        } else {
            data.add(HttpConnection.KeyVal.create(name, el.val()));
        }
    }
    return data;
}
项目:J-Kinopoisk2IMDB    文件:MovieAuthStringFetcher.java   
/**
 * Opens movie page using {@link Movie#imdbId}
 *
 * @param movie Movie which page should be opened
 * @throws IOException If an I/O error occurs
 */
@Override
public ExchangeObject<String> prepare(@NonNull Movie movie) throws IOException {
    val moviePageLink = new URL("http://www.imdb.com/title/" + movie.getImdbId());

    val request = HttpConnection.connect(moviePageLink)
            .userAgent(config.getString("user_agent"))
            .timeout(config.getInt("timeout"))
            .cookie("id", config.getString("auth"))
            .request();

    return new ExchangeObject<>(request, getResponseProcessor());
}
项目:J-Kinopoisk2IMDB    文件:IMDBXMLExchangeStrategy.java   
/**
 * {@inheritDoc}
 */
@Override
public Connection.Request buildRequest(@NonNull final Movie movie) {
    val searchLink = "http://www.imdb.com/xml/find";
    val queryParams = new ImmutableMap.Builder<String, String>()
            .put("q", movie.getTitle())
            .put("tt", "on")
            .put("nr", "1")
            .build();

    return HttpConnection.connect(HttpUtils.buildURL(searchLink, queryParams)).request();
}
项目:J-Kinopoisk2IMDB    文件:IMDBHTMLExchangeStrategy.java   
/**
 * {@inheritDoc}
 */
@Override
public Connection.Request buildRequest(@NonNull final Movie movie) {
    val searchLink = "http://www.imdb.com/find";
    val queryParams = new ImmutableMap.Builder<String, String>()
            .put("q", movie.getTitle())
            .put("s", "tt")
            //.put("exact", "true")
            .put("ref", "fn_tt_ex")
            .build();

    return HttpConnection.connect(HttpUtils.buildURL(searchLink, queryParams)).request();
}
项目:J-Kinopoisk2IMDB    文件:OMDBExchangeStrategy.java   
@Override
public Connection.Request buildRequest(@NonNull Movie movie) {
    val searchLink = "http://www.omdbapi.com";
    val queryParams = new ImmutableMap.Builder<String, String>()
            .put("t", movie.getTitle())
            .put("plot", "short")
            .put("r", "json")
            .build();

    return HttpConnection.connect(HttpUtils.buildURL(searchLink, queryParams))
            .ignoreContentType(true)
            .request();
}
项目:J-Kinopoisk2IMDB    文件:IMDBJSONExchangeStrategy.java   
/**
 * {@inheritDoc}
 */
@Override
public Connection.Request buildRequest(@NonNull final Movie movie) {
    val searchLink = "http://www.imdb.com/xml/find";
    val queryParams = new ImmutableMap.Builder<String, String>()
            .put("q", movie.getTitle())
            .put("tt", "on")
            .put("nr", "1")
            .put("json", "1")
            .build();

    return HttpConnection.connect(HttpUtils.buildURL(searchLink, queryParams)).request();
}
项目:zeak.android    文件:ZeakSSLConnect.java   
private Document getZeakdata(String getURL) {

            Document dd = null;

            try {
                //disableSSLCertCheck();
                Connection connection3 = HttpConnection.connect(getURL)
                        .cookies(cooca)
                        .ignoreHttpErrors(true)
                        .ignoreContentType(true)
                        .validateTLSCertificates(false)
                        .userAgent(useragent);
                Log.d(mainActivity.TAG,"getZeakdata:Start");
                Connection.Response response3 = connection3.execute();
                Log.d(mainActivity.TAG,"getZeakdata:statuscode:"+ String.valueOf(response3.statusCode()));
                // Получили json из сервиса
                if (debug) {
                    Log.d(mainActivity.TAG,"getZeakdata:body:"+ response3.body());
                }


                if (debug) {
                    for (Map.Entry<String, String> cookie : response3.cookies().entrySet()) {
                        Log.d(mainActivity.TAG,"cookie2"+ cookie.getKey() + " : " + cookie.getValue());

                    }
                    for (Map.Entry<String, String> head : response3.headers().entrySet()) {
                        Log.d(mainActivity.TAG,"headers2"+ head.getKey() + " : " + head.getValue());
                    }
                }


                dd = response3.parse();
                Log.d(mainActivity.TAG,"getZeakdata:END!");

            } catch (Exception e) {
                e.printStackTrace();
            }
            return dd;
        }
项目:zeak.android    文件:ZeakPlainConnect.java   
private Document getZeakdata(String getURL) {

            Document dd = null;

            try {
                Connection connection3 = HttpConnection.connect(getURL)
                        .cookies(cooca)
                        .ignoreHttpErrors(true)
                        .ignoreContentType(true)
                        .userAgent(useragent);
                Log.d("getZeakdata:", "Start");
                Connection.Response response3 = connection3.execute();

                // Получили json из сервиса
                if (debug) {
                    Log.d("getZeakdata:body:", response3.body());
                }


                if (debug) {
                    for (Map.Entry<String, String> cookie : response3.cookies().entrySet()) {
                        Log.d("cookie2", cookie.getKey() + " : " + cookie.getValue());

                    }
                    for (Map.Entry<String, String> head : response3.headers().entrySet()) {
                        Log.d("headers2", head.getKey() + " : " + head.getValue());
                    }
                }


                dd = response3.parse();
                Log.d("getZeakdata:", "END!");

            } catch (Exception e) {
                e.printStackTrace();
            }
            return dd;
        }
项目:zeak.android    文件:ZeakPlainConnect.java   
private void connectzeak() {

            String token = "";
            String key;
            String val;

            try {
                Log.d("connectzeak:", "Start");
                connected = Boolean.FALSE;
                Log.d("connec:cooca.isEmpty:", "True");

                //получаем страницу входа
                Connection connection1 = HttpConnection.connect(loginURL)
                        .ignoreHttpErrors(true)
                        .userAgent(useragent);
                Log.d("connectzeak:2:", "Zeak2");
                Connection.Response response1 = connection1.execute();

                if (debug) {
                    Log.d("connectzeak:3:", response1.body());
                }


                //находим csrf-токен (token) для последующиго POST запроса
                for (Map.Entry<String, String> cookie : response1.cookies().entrySet()) {
                    key = cookie.getKey();
                    val = cookie.getValue();
                    Log.d("connectzeak.cookie1", key + " : " + val);
                    if (key.equals("csrftoken")) {
                        token = val;
                        Log.d("connectzeak.token", key + " : " + val);
                    }
                }

                //Пробегаемся по хедерам и выводим их в дебаг
                if (debug) {
                    for (Map.Entry<String, String> head : response1.headers().entrySet()) {
                        Log.d("headers1", head.getKey() + " : " + head.getValue());
                    }
                    Log.d("connectzeak.headers1", " .... ");
                }


                //делаем пост запрос для подключения к зеаку
                Connection connection2 = connection1.url(loginURL)
                        // .timeout(7000)
                        .cookies(response1.cookies())
                        .ignoreHttpErrors(true)
                        .data("username", login)
                        .data("password", pass)
                        .data("csrfmiddlewaretoken", token)
                        .data("next", itemURL)
                        .method(Connection.Method.POST)
                        .followRedirects(true);
                Connection.Response response2 = connection2.ignoreContentType(true).execute();
                Log.d("connectzeak", "add cookies in variables");
                cooca.putAll(response2.cookies());
                Log.d("connectzeak", "done add cookies in variables");
                connected = Boolean.TRUE;
                Log.d("connectzeak", "connected zeak true!");
                Log.d("connectzeak:", "END");
            } catch (Exception e) {
                e.printStackTrace();
                connected = Boolean.FALSE;
            }

        }
项目:common    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:gestock    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:CN1ML-NetbeansModule    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:astor    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:astor    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:astor    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:BoL-API-Parser    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:JabRefAutocomplete    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:AngelList-Mobile    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:jsoup-learning    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:idylfin    文件:Jsoup.java   
/**
 * Creates a new {@link Connection} to a URL. Use to fetch and parse a HTML page.
 * <p>
 * Use examples:
 * <ul>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").userAgent("Mozilla").data("name", "jsoup").get();</code></li>
 *  <li><code>Document doc = Jsoup.connect("http://example.com").cookie("auth", "token").post();</code></li>
 * </ul>
 * @param url URL to connect to. The protocol must be {@code http} or {@code https}.
 * @return the connection. You can add data, cookies, and headers; set the user-agent, referrer, method; and then execute.
 */
public static Connection connect(String url) {
    return HttpConnection.connect(url);
}
项目:common    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:gestock    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:CN1ML-NetbeansModule    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:astor    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:astor    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:astor    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:BoL-API-Parser    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:JabRefAutocomplete    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws IOException If the final server response != 200 OK (redirects are followed), or if there's an error reading
 the response stream.

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:AngelList-Mobile    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:jsoup-learning    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}
项目:idylfin    文件:Jsoup.java   
/**
 Fetch a URL, and parse it as HTML. Provided for compatibility; in most cases use {@link #connect(String)} instead.
 <p>
 The encoding character set is determined by the content-type header or http-equiv meta tag, or falls back to {@code UTF-8}.

 @param url           URL to fetch (with a GET). The protocol must be {@code http} or {@code https}.
 @param timeoutMillis Connection and read timeout, in milliseconds. If exceeded, IOException is thrown.
 @return The parsed HTML.

 @throws java.net.MalformedURLException if the request URL is not a HTTP or HTTPS URL, or is otherwise malformed
 @throws HttpStatusException if the response is not OK and HTTP response errors are not ignored
 @throws UnsupportedMimeTypeException if the response mime type is not supported and those errors are not ignored
 @throws java.net.SocketTimeoutException if the connection times out
 @throws IOException if a connection or read error occurs

 @see #connect(String)
 */
public static Document parse(URL url, int timeoutMillis) throws IOException {
    Connection con = HttpConnection.connect(url);
    con.timeout(timeoutMillis);
    return con.get();
}