本文整理匯總了Java中org.apache.commons.httpclient.methods.PostMethod.getResponseHeaders方法的典型用法代碼示例。如果您正苦於以下問題:Java PostMethod.getResponseHeaders方法的具體用法?Java PostMethod.getResponseHeaders怎麽用?Java PostMethod.getResponseHeaders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.httpclient.methods.PostMethod
的用法示例。
在下文中一共展示了PostMethod.getResponseHeaders方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: post
import org.apache.commons.httpclient.methods.PostMethod; //導入方法依賴的package包/類
/**
* Send a POST request
* @param cluster the cluster definition
* @param path the path or URI
* @param headers the HTTP headers to include, <tt>Content-Type</tt> must be
* supplied
* @param content the content bytes
* @return a Response object with response detail
* @throws IOException
*/
public Response post(Cluster cluster, String path, Header[] headers,
byte[] content) throws IOException {
PostMethod method = new PostMethod();
try {
method.setRequestEntity(new ByteArrayRequestEntity(content));
int code = execute(cluster, method, headers, path);
headers = method.getResponseHeaders();
content = method.getResponseBody();
return new Response(code, headers, content);
} finally {
method.releaseConnection();
}
}