J2ME HTTP POST

作者:网络 来源:佚名 更新时间:2008-02-08 23:21:48 点击:
1.通过post方法,发送数据至http server
2.大家通常忽略content-type和content-length

......
conn.setrequestmethod(httpconnection.post);

conn.setrequestproperty("user-agent","profile/midp-1.0 configuration/cldc-1.0" );
conn.setrequestproperty("content-language", "en-us" );

postmsg = request.getbytes();

conn.setrequestproperty("content-type", "application/x-www-form-urlencoded");
conn.setrequestproperty("content-length",integer.tostring( postmsg != null?postmsg.length : 0 ) );

out = conn.openoutputstream();
out.write(postmsg);
......


  • 本文来源于网页设计爱好者web开发社区http://www.html.org.cn收集整理,欢迎访问。