欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
客戶(hù)端post帶參數URL+XML,服務(wù)器端讀取
客戶(hù)端:

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.RequestEntity;
import org.apache.commons.httpclient.methods.StringRequestEntity;

public class HttpClientTest {

String data = "<root><header><type>fetch</type></header><content><program>test</program></content></root>";
String url = "http://localhost:8080/SgWebSer/AppStatus?username=cc&pwd=11";

public void postSend() {
HttpClient httpclient = new HttpClient();
PostMethod post = new PostMethod(url);
String info = null;
try {
RequestEntity entity = new StringRequestEntity(data, "text/xml",
"iso-8859-1");
post.setRequestEntity(entity);
httpclient.executeMethod(post);
int code = post.getStatusCode();
if (code == HttpStatus.SC_OK)
info = new String(post.getResponseBodyAsString());
} catch (Exception ex) {
ex.printStackTrace();
} finally {
post.releaseConnection();
}
}

public static void main (String[] args)
{
HttpClientTest hct = new HttpClientTest();
hct.postSend();
}
}


服務(wù)器端 

doPost


String username = request.getParameter("username"); 

用的都是Jdom哦
SAXBuilder builder = new SAXBuilder();
InputSource is = new InputSource();
try {
is.setByteStream(request.getInputStream());
is.setEncoding("iso-8859-1");
Document document = builder.build(is);
document.getRootElement().getChild("header").getChild("type").getText();
Format format = Format.getPrettyFormat();     
       format.setEncoding("UTF-8");// 設置xml文件的字符為UTF-8,解決中文問(wèn)題     
       XMLOutputter xmlout = new XMLOutputter(format);     
       ByteArrayOutputStream bo = new ByteArrayOutputStream();     
       xmlout.output(document, bo);
       String s = bo.toString();
System.out.println(bo.toString());
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (JDOMException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
httpclient教程
利用HttpClient獲取網(wǎng)頁(yè)內容
HTTP
httpclient apache commons區別
用HttpClient來(lái)模擬瀏覽器GET POST
運用Apache HttpClient實(shí)作Get與Post動(dòng)作 - 小嘴冰涼 - ITey...
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久