什么是HTTP POST方法的android系统中的最大尺寸 [英] What is the maximum size of HTTP Post method in android

查看:94
本文介绍了什么是HTTP POST方法的android系统中的最大尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是Android的Post方法的最大尺寸是多少?当我从服务器获取的响应,消息的某些部分缺失。我认为它可能已经达到了POST方法的最大尺寸。
如果没有为POST方法没有限制,我才需要更改这个我的服务器规范?

What is the maximum size of android Post method? When I am getting responses from server, parts of the message are missing. I think it may have reached the maximum size of post method. If there is no limit for post method, did I need to change my server specification for this?

推荐答案

我有同样的问题,我用HttpPost和响应从服务器得到,但数据的一部分错过了,因为他们非常大的规模。这就是为什么我使用了另一种方式:用HttpURLConnection类为OuputStream发送请求到服务器和BufferedReader / InputStream中得到响应

I had the same problem, I used HttpPost and the response got from server but a part of data missed because of their very big size. That's why I used an other way : HttpURLConnection with OuputStream to send request to the server and BufferedReader/InputStream to get responses.

    HttpURLConnection my_httpConnection = (HttpURLConnection) new URL("https://integrator-ut.vegaconnection.com/Authentication.svc?wsdl").openConnection();
    my_httpConnection.setRequestMethod("POST");
    my_httpConnection.setDoInput(true);
    my_httpConnection.setDoOutput(true);
    my_httpConnection.setRequestProperty("Content-type", "text/xml; charset=utf-8");



   OutputStream my_outPutStream = this.my_httpConnection.getOutputStream();
   Writer my_writer = new OutputStreamWriter(my_outPutStream);
   my_writer.write(YOUR_REQUEST); //YOUR_REQUEST is a String
   my_writer.flush();
   my_writer.close();           

   BufferedReader my_bufferReader = new BufferedReader(new InputStreamReader(this.my_httpConnection.getInputStream()));
    char[] buffer = new char[10000];
    int nbCharRead=0;
    try
    {
        while((nbCharRead = my_bufferReader.read(buffer, 0, 10000)) != -1)
        {
             /* Your treatement : saving on a file/arraylist/etc

        }
    }

这篇关于什么是HTTP POST方法的android系统中的最大尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆