當前位置: 首頁>>代碼示例>>Java>>正文


Java Connection.Request方法代碼示例

本文整理匯總了Java中org.jsoup.Connection.Request方法的典型用法代碼示例。如果您正苦於以下問題:Java Connection.Request方法的具體用法?Java Connection.Request怎麽用?Java Connection.Request使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jsoup.Connection的用法示例。


在下文中一共展示了Connection.Request方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fetchHandlesXml

import org.jsoup.Connection; //導入方法依賴的package包/類
@Test
public void fetchHandlesXml() throws IOException {
    // should auto-detect xml and use XML parser, unless explicitly requested the html parser
    String xmlUrl = "http://direct.infohound.net/tools/parse-xml.xml";
    Connection con = Jsoup.connect(xmlUrl);
    Document doc = con.get();
    Connection.Request req = con.request();
    assertTrue(req.parser().getTreeBuilder() instanceof XmlTreeBuilder);
    assertEquals("<xml> <link> one </link> <table> Two </table> </xml>", StringUtil.normaliseWhitespace(doc.outerHtml()));
}
 
開發者ID:cpusoft,項目名稱:common,代碼行數:11,代碼來源:UrlConnectTest.java

示例2: ExchangeObject

import org.jsoup.Connection; //導入方法依賴的package包/類
public ExchangeObject(Connection.Request request, ResponseProcessor<OUT> responseProcessor) throws IOException {
    this.request = request;
    this.responseProcessor = responseProcessor;
    this.responseSupplier = rethrowSupplier(() -> Jsoup.connect(request.url().toString())
            .request(request)
            .execute()
    );
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:9,代碼來源:Exchangeable.java

示例3: buildRequest

import org.jsoup.Connection; //導入方法依賴的package包/類
/**
 * {@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();
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:15,代碼來源:IMDBXMLExchangeStrategy.java

示例4: buildRequest

import org.jsoup.Connection; //導入方法依賴的package包/類
/**
 * {@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();
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:16,代碼來源:IMDBHTMLExchangeStrategy.java

示例5: buildRequest

import org.jsoup.Connection; //導入方法依賴的package包/類
@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();
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:14,代碼來源:OMDBExchangeStrategy.java

示例6: buildRequest

import org.jsoup.Connection; //導入方法依賴的package包/類
/**
 * {@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();
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:16,代碼來源:IMDBJSONExchangeStrategy.java

示例7: fetchHandlesXmlAsHtmlWhenParserSet

import org.jsoup.Connection; //導入方法依賴的package包/類
@Test
public void fetchHandlesXmlAsHtmlWhenParserSet() throws IOException {
    // should auto-detect xml and use XML parser, unless explicitly requested the html parser
    String xmlUrl = "http://direct.infohound.net/tools/parse-xml.xml";
    Connection con = Jsoup.connect(xmlUrl).parser(Parser.htmlParser());
    Document doc = con.get();
    Connection.Request req = con.request();
    assertTrue(req.parser().getTreeBuilder() instanceof HtmlTreeBuilder);
    assertEquals("<html> <head></head> <body> <xml> <link>one <table> Two </table> </xml> </body> </html>", StringUtil.normaliseWhitespace(doc.outerHtml()));
}
 
開發者ID:cpusoft,項目名稱:common,代碼行數:11,代碼來源:UrlConnectTest.java

示例8: timeout

import org.jsoup.Connection; //導入方法依賴的package包/類
@Override
public Connection.Request timeout(int millis) {
    return null;
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:5,代碼來源:Exchangeable.java

示例9: maxBodySize

import org.jsoup.Connection; //導入方法依賴的package包/類
@Override
public Connection.Request maxBodySize(int bytes) {
    return null;
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:5,代碼來源:Exchangeable.java

示例10: data

import org.jsoup.Connection; //導入方法依賴的package包/類
@Override
public Connection.Request data(Connection.KeyVal keyval) {
    return null;
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:5,代碼來源:Exchangeable.java

示例11: postDataCharset

import org.jsoup.Connection; //導入方法依賴的package包/類
@Override
public Connection.Request postDataCharset(String charset) {
    return null;
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:5,代碼來源:Exchangeable.java

示例12: header

import org.jsoup.Connection; //導入方法依賴的package包/類
@Override
public Connection.Request header(String name, String value) {
    return null;
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:5,代碼來源:Exchangeable.java

示例13: removeHeader

import org.jsoup.Connection; //導入方法依賴的package包/類
@Override
public Connection.Request removeHeader(String name) {
    return null;
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:5,代碼來源:Exchangeable.java

示例14: cookie

import org.jsoup.Connection; //導入方法依賴的package包/類
@Override
public Connection.Request cookie(String name, String value) {
    return null;
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:5,代碼來源:Exchangeable.java

示例15: removeCookie

import org.jsoup.Connection; //導入方法依賴的package包/類
@Override
public Connection.Request removeCookie(String name) {
    return null;
}
 
開發者ID:REDNBLACK,項目名稱:J-Kinopoisk2IMDB,代碼行數:5,代碼來源:Exchangeable.java


注:本文中的org.jsoup.Connection.Request方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。