现在一个请求中,有一个参数的值比较多数据,需要向header中以流的形式写入数据,然后服务器端再通过流的形式从header中取数据,该怎么做

解决方案 »

  1.   

    直接下载不就得了,还要往head里写那么多数据
      

  2.   

    几M,因为用get方式提交时不能超过1024字节,不够用,也不能用post
      

  3.   

    可能是我没表述明白,现在是客户端向一个接口发送一个请求,里面有几个参数,一些参数数据小的就直接在请求中“?c参数名=参数值”的传过去,而其中有个参数的数据是比较大的,问过老大,我们老大说可以以流的形式写入header中一起发过去,服务器端在通过流的形式接收就好了,问题就在于现在不知道怎么把数据写入headr中
      

  4.   

    servlet中定义了doHead doHeadprotected 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协议。
      

  5.   

    根据你的需求,感觉post提交比较靠谱,不限制提交数据的大小。