本文整理匯總了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;
}