创建一个从数据源获取指令(步骤)并自动执行少量 HC(http://hc.apache.org Apache Http Client)操作的类。
希望能够执行 HTTP post、get 和direct(如向 Web 服务器发送 JSON 或 XML/soap 消息)调用。
对何时使用 BasicHttpEntityEnclosureRequest 与 BasicHttpReques 感到困惑,什么是封闭的?现在我有步骤来初始化上下文,提供参数值,URL,方法等,当我想提交这就是我正在做的事情:
HttpPost httpost = null;//todo correct method
//HttpEntity resp = this.httpclient.e
HttpEntityEnclosingRequest reqEntity1 = null;//use this
HttpRequest reqEntity = new BasicHttpRequest(method, urls, httpVer );//or this?
URL url = new URL(urls);
String hostNm = url.getHost();
int port = url.getPort();
String sche = url.getProtocol();
logger.info("scheme/ proto :" + sche);
HttpHost httpHost = new HttpHost (hostNm, port, sche);
response = this.httpclient.execute(httpHost, reqEntity, localContext);
问题:使用一个或另一个或有另一个属性来封闭或常规 HttpRequest?
看
http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/HttpRequest.html