当前位置: 首页>>代码示例>>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;未经允许,请勿转载。