-1

I have connected to a REST server using the Java object RestTemplate. The REST responds with the big data, but my program can not receive JSON with length over 10000 chars. Please suggest how to increase the length of JSON received data.

paisanco
  • 3,834
  • 6
  • 26
  • 31
exec4life
  • 31
  • 6
  • 1
    Cannot get more than 10K chars for what reason? Note that HTTP protocols often break long transfers into pieces, but the proper code on the receiving end will reconnect the pieces. (Naive code, on the other hand, will perceive the transfer to be truncated.) – Hot Licks Aug 29 '14 at 03:06
  • 1
    what you mean with "connected to the REST"? If I understand you are trying to connect to a REST service with spring RestTemplate. But, when the json response is bigger than 10000 chars it blows up? The question is confusing – Alejandro Diaz Aug 29 '14 at 03:08
  • 1
    Can you post the error? – Alejandro Diaz Aug 29 '14 at 03:09
  • 1
    Can you post an example with your code? It's not possible to tell where the problem is now. – paisanco Aug 29 '14 at 03:10
  • Streaming API ? http://stackoverflow.com/questions/444380/is-there-a-streaming-api-for-json – Abhi Aug 29 '14 at 03:16
  • Thanks for all your explain! I will try to use another client-api lib to do it and I will report the detail result. – exec4life Aug 29 '14 at 05:00
  • @exec4life Is it POST or GET or simple HTTP request – Ankur Singhal Aug 29 '14 at 08:56

1 Answers1

-1

The problem is likely that you are sending the data in a GET request, so it's sent in the URL. Different browsers have different limits for the URL, where IE has the lowest limist of about 2 kB. To be safe, you should never send more data than about a kilobyte in a GET request.

To send that much data, you have to send it in a POST request instead. The browser has no hard limit on the size of a post, but the server has a limit on how large a request can be. IIS for example has a default limit of 4 MB, but it's possible to adjust the limit if you would ever need to send more data than that.

Ankur Singhal
  • 23,626
  • 10
  • 70
  • 108