?请教:十万火急使用java.net中httpURLConnection类模拟post方法

cyberguy 2002-01-24 02:59:15
由于httpString的参数很多,大约有8000个,因而有URL TOO LONG的例外,
有方法解决,请给出正确的POST方法

httpString= "........"; //参数很多
URL cgi_link = new URL(WebProtocol,WebHost,WebPort,httpString)
this.urlConnection = url.openConnection();
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.setAllowUserInteraction(false);
DataOutputStream server = new DataOutputStream urlConnection.getOutputStream()); server.writeBytes(httpString);
server.close();
...全文
102 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
cyberguy 2002-01-24
  • 打赏
  • 举报
回复
真正的出错的(url too long)是下边这句
DataOutputStream server = new DataOutputStream(urlConnection.getOutputStream());
高手们,快出现吧
cyberguy 2002-01-24
  • 打赏
  • 举报
回复
httpString= "........"; //参数很多
URL cgi_link = new URL(WebProtocol,WebHost,WebPort,httpString)
出现 Url too long 的例外。
现在用的是urlConnection 类
cyberguy 2002-01-24
  • 打赏
  • 举报
回复
lickylao@21cn.com
skyyoung 2002-01-24
  • 打赏
  • 举报
回复
shmilu@sina.com
skyyoung 2002-01-24
  • 打赏
  • 举报
回复
http://www.innovation.ch/java/HTTPClient/

23,408

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧