2.如果某天她们分开了,当她们彼此想念的时候,她们可以把自己的JAR包放在公共仓库之中,
这样,她们又可以相互依赖了。MAVEN可以实现自动上传JAR包到某仓库,当然手动放也是可以的哦.
3.在给他人提供依赖的JAR包原则是应该是完整的,好像本地方法一样使用,例如不适宜提供接口而不提供
接口的实现
4.依赖并不是必须的,她们可以在已知通信协议的情况下,自己编写访问的代码
5.对于一个大的SDK比较好的做法是调用远程服务器代码和DTO代码应该分成两个JAR包,使用方
可以选择两个JAR都要,直接使用SDK方法就可以了,还有一种做法就是我只要你的DTO,调用方法自己
编写,这样给使用方带来了更好的选择。
把post的改成put试试HttpPost httpPost = new HttpPost("http xxx")
List <NameValuePair>nvps = new ArrayList <NameValuePair>()
nvps.add(new BasicNameValuePair("username", "vip"))
nvps.add(new BasicNameValuePair("password", "secret"))
httpPost.setEntity(new UrlEncodedFormEntity(nvps))
CloseableHttpResponse response2 = httpclient.execute(httpPost)
try {
System.out.println(response2.getStatusLine())
HttpEntity entity2 = response2.getEntity()
// do something useful with the response body
// and ensure it is fully consumed
EntityUtils.consume(entity2)
} finally {
response2.close()
}
第一:先把url存储下来,配置文件,数据库等第二:在相应的action层调用项目里面的httpClientUtil或者采用apache的httpClient 去请求url,
接下来的操作跟一般的web没区别了