Apache HttpClient Cookie rejected解决方法
Cookie rejected: "$Version=0; U_TRS1=00000047.3aad5d7b.4d100777.d3167fc5; $Path=/; $Domain=.sina.com.cn". Domain attribute ".sina.com.cn" violates RFC 2109: host minus domain may not contain any dots 的解决方法:此类错误代码前段加增加(Httpclient4
httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.BEST_MATCH);
并且下面代买需要使用缓存流读取数据,如下:
InputStream in = entity.getContent();
BufferedInputStream reader = new BufferedInputStream(in);
StringBuffer result = new StringBuffer();
BufferedReader br = null;
if (entity != null) {
br = new BufferedReader(new InputStreamReader(entity.getContent()));
String line = "";
while ((line = br.readLine()) != null) {
result.append(line + "\n");
}
}
System.out.println(new String(result));
补充:综合编程 , 其他综合 ,