private void postInfo(String tourl,SystemPostDTO systemPostDTO){
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(tourl);
try {
method.addRequestHeader("Content", "text/html,charset=utf-8");
JSONObject result = JSONObject.fromObject(systemPostDTO);
method.addParameter("systemPostDTO",result.toString());
int statusCode = client.executeMethod(method);
if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
Header locationHeader = method.getResponseHeader("location");
String location = null;
if (locationHeader != null) {
location = locationHeader.getValue();
postInfo(location,systemPostDTO);//Jump and re-request
}
}
if(method!=null){
method.releaseConnection();
}
} catch (Exception e) {
e.printStackTrace();
}
}
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(tourl);
try {
method.addRequestHeader("Content", "text/html,charset=utf-8");
JSONObject result = JSONObject.fromObject(systemPostDTO);
method.addParameter("systemPostDTO",result.toString());
int statusCode = client.executeMethod(method);
if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
Header locationHeader = method.getResponseHeader("location");
String location = null;
if (locationHeader != null) {
location = locationHeader.getValue();
postInfo(location,systemPostDTO);//Jump and re-request
}
}
if(method!=null){
method.releaseConnection();
}
} catch (Exception e) {
e.printStackTrace();
}
}