本文整理汇总了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()));
}
示例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()
);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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()));
}
示例8: timeout
import org.jsoup.Connection; //导入方法依赖的package包/类
@Override
public Connection.Request timeout(int millis) {
return null;
}
示例9: maxBodySize
import org.jsoup.Connection; //导入方法依赖的package包/类
@Override
public Connection.Request maxBodySize(int bytes) {
return null;
}
示例10: data
import org.jsoup.Connection; //导入方法依赖的package包/类
@Override
public Connection.Request data(Connection.KeyVal keyval) {
return null;
}
示例11: postDataCharset
import org.jsoup.Connection; //导入方法依赖的package包/类
@Override
public Connection.Request postDataCharset(String charset) {
return null;
}
示例12: header
import org.jsoup.Connection; //导入方法依赖的package包/类
@Override
public Connection.Request header(String name, String value) {
return null;
}
示例13: removeHeader
import org.jsoup.Connection; //导入方法依赖的package包/类
@Override
public Connection.Request removeHeader(String name) {
return null;
}
示例14: cookie
import org.jsoup.Connection; //导入方法依赖的package包/类
@Override
public Connection.Request cookie(String name, String value) {
return null;
}
示例15: removeCookie
import org.jsoup.Connection; //导入方法依赖的package包/类
@Override
public Connection.Request removeCookie(String name) {
return null;
}