wmv解码器-windows xp mode

httpclientpost
2023年4月3日发(作者:风速网络电视下载)

HttpClient通过HttpPost传递参数

HttpClient新版本(新⽼版本没有做明确界定,Sorry!)

Java代码

ehttp;

2.

ist;

;

5.

luePair;

ient;

odedFormEntity;

st;

tHttpClient;

ameValuePair;

12.

classHttpTests{

14.

15./**

16.*@paramargs

17.*@throwsException

18.*/

staticvoidmain(String[]args)throwsException{

ienthttpclient=newDefaultHttpClient();

sthttpPost=newHttpPost("******/abc");

nvps=newArrayList();

(newBasicNameValuePair("username","vip"));

(newBasicNameValuePair("password","secret"));

ity(newUrlEncodedFormEntity(nvps));

e(httpPost);

nectionManager().shutdown();

28.}

29.

30.}

HttpClient⽼版本:

Java代码

ehttp;

2.

ient;

luePair;

thod;

6.

classHttpTests{

8.

9./**

10.*@paramargs

11.*@throwsException

12.*/

staticvoidmain(String[]args)throwsException{

ienthttpclient=newHttpClient();

thodhttpPost=newPostMethod("******/abc");

luePair[]param={newNameValuePair("username","vip")};

uestBody(param);

eMethod(httpPost);

19.}

20.

21.}

更多推荐

httpclientpost