java在http请求中传递大数据

huangzebiao007 2013-10-23 05:55:50
现在一个请求中,有一个参数的值比较多数据,需要向header中以流的形式写入数据,然后服务器端再通过流的形式从header中取数据,该怎么做
...全文
960 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhuweisyyc 2013-10-24
  • 打赏
  • 举报
回复
根据你的需求,感觉post提交比较靠谱,不限制提交数据的大小。
teemai 2013-10-24
  • 打赏
  • 举报
回复
引用 5 楼 huangzebiao007 的回复:
引用 3 楼 huxiweng 的回复:
直接下载不就得了,还要往head里写那么多数据
可能是我没表述明白,现在是客户端向一个接口发送一个请求,里面有几个参数,一些参数数据小的就直接在请求中“?c参数名=参数值”的传过去,而其中有个参数的数据是比较大的,问过老大,我们老大说可以以流的形式写入header中一起发过去,服务器端在通过流的形式接收就好了,问题就在于现在不知道怎么把数据写入headr中
servlet中定义了doHead doHead protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException Receives an HTTP HEAD request from the protected service method and handles the request. The client sends a HEAD request when it wants to see only the headers of a response, such as Content-Type or Content-Length. The HTTP HEAD method counts the output bytes in the response to set the Content-Length header accurately. If you override this method, you can avoid computing the response body and just set the response headers directly to improve performance. Make sure that the doHead method you write is both safe and idempotent (that is, protects itself from being called multiple times for one HTTP HEAD request). If the HTTP HEAD request is incorrectly formatted, doHead returns an HTTP "Bad Request" message. Parameters: req - the request object that is passed to the servlet resp - the response object that the servlet uses to return the headers to the clien Throws: java.io.IOException - if an input or output error occurs ServletException - if the request for the HEAD could not be handled ======================= 据我了解,head头里不能存放大量的数据,建议去研究下HTTP协议。
huangzebiao007 2013-10-24
  • 打赏
  • 举报
回复
引用 3 楼 huxiweng 的回复:
直接下载不就得了,还要往head里写那么多数据
可能是我没表述明白,现在是客户端向一个接口发送一个请求,里面有几个参数,一些参数数据小的就直接在请求中“?c参数名=参数值”的传过去,而其中有个参数的数据是比较大的,问过老大,我们老大说可以以流的形式写入header中一起发过去,服务器端在通过流的形式接收就好了,问题就在于现在不知道怎么把数据写入headr中
huangzebiao007 2013-10-24
  • 打赏
  • 举报
回复
引用 1 楼 xcmxjge 的回复:
到底有多大的参数数据?
几M,因为用get方式提交时不能超过1024字节,不够用,也不能用post
teemai 2013-10-23
  • 打赏
  • 举报
回复
直接下载不就得了,还要往head里写那么多数据
wolfguy_pan 2013-10-23
  • 打赏
  • 举报
回复
你这个比较多的参数数据是多大。。。 大数据都上G了。。。看着标题进来的。。。
jige_hanhan 2013-10-23
  • 打赏
  • 举报
回复
到底有多大的参数数据?

67,511

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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