本文整理匯總了Java中org.jsoup.Connection.method方法的典型用法代碼示例。如果您正苦於以下問題:Java Connection.method方法的具體用法?Java Connection.method怎麽用?Java Connection.method使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jsoup.Connection
的用法示例。
在下文中一共展示了Connection.method方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createPostStringConnection
import org.jsoup.Connection; //導入方法依賴的package包/類
/**
* 構建一個請求類型為POST,返回類型為String的抓取連接
*/
public static Connection createPostStringConnection(boolean isUseProxy, String url, String cookie, String UA, String referer, String host,
String... postData) {
Connection connection = createStringConnection(isUseProxy, url, cookie, UA, referer, host);
connection.method(Connection.Method.POST);
connection.data(postData);
return connection;
}
示例2: createGetDocumentConnection
import org.jsoup.Connection; //導入方法依賴的package包/類
/**
* 構建一個請求類型為GET,返回類型為document的抓取連接
*/
public static Connection createGetDocumentConnection(boolean isUseProxy, String url, String cookie) {
Connection connection = getConnection(url, cookie);
connection.method(Connection.Method.GET);
return connection;
}
示例3: createPostDocumentConnection
import org.jsoup.Connection; //導入方法依賴的package包/類
/**
* 構建一個請求類型為POST,返回類型為document的抓取連接
*/
public static Connection createPostDocumentConnection(boolean isUseProxy, String url, String cookie, String UA, String referer, String host) {
Connection connection = getConnection(url, cookie, UA, referer, host);
connection.method(Connection.Method.POST);
return connection;
}
示例4: createGetStringConnection
import org.jsoup.Connection; //導入方法依賴的package包/類
/**
* 構建一個請求類型為GET,返回類型為String的抓取連接
*/
public static Connection createGetStringConnection(boolean isUseProxy, String url, String cookie, String UA, String referer, String host) {
Connection connection = createStringConnection(isUseProxy, url, cookie, UA, referer, host);
connection.method(Connection.Method.GET);
return connection;
}
示例5: method
import org.jsoup.Connection; //導入方法依賴的package包/類
@Test public void method() {
Connection con = HttpConnection.connect("http://example.com/");
assertEquals(Connection.Method.GET, con.request().method());
con.method(Connection.Method.POST);
assertEquals(Connection.Method.POST, con.request().method());
}