当前位置:开发者网络 >> 技术教程 >> JSP教程 >> J2ME开发 >> 内容
精彩推荐
分类最新教程
分类热点教程
  
J2ME HTTP POST
作者:未知
日期:2004-09-22
人气:
投稿:snow(转贴)
来源:未知
字体:
收藏:加入浏览器收藏
以下正文:
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);
......


相关文章: