你能帮我解决这个问题:
对于http响应,我得到200(成功)而不是302(重定向),我得到2而不是3个cookie标头作为响应。 我如何允许重新指示?任何输入都会很好。
我的代码是:
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
try {
httppost.setParams(new BasicHttpParams().setParameter("A", "B"));
httppost.setParams(new BasicHttpParams().setParameter("C", "D"));
httppost.setParams(new BasicHttpParams().setParameter("E", "F"));
httppost.setParams(new BasicHttpParams().setParameter("G", "H"));
httppost.setParams(new BasicHttpParams().setParameter("I", "J"));
httppost.setParams(new BasicHttpParams().setParameter("K", "L"));
httppost.setParams(new BasicHttpParams().setParameter("M", bundle.getString("responsedata")));
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(postParameters);
httppost.setEntity(formEntity);
HttpResponse sessionresp = httpclient.execute(httppost);
Header[] headers = sessionresp.getAllHeaders();
for (int i=0; i < headers.length; i++) {
Header h = headers[i];
Log.i(TAG, "Header names: "+h.getName());
Log.i(TAG, "Header Value: "+h.getValue());
}
Log.i("sucess: ", sessionresp.getStatusLine().getStatusCode()+"");