简体   繁体   中英

What is the max size of String parameter in web service?

I need to create web service in java (for generating reports) that receives a String with JSON format for the tables' information. May be will be a large amount of characters but I don't know for sure if this will have trouble at moment to receive them.

Are there restrictions about the size of String parameter in the method? Or if you have any suggestion about json or something else I'll be grateful. Thanks.

Your concern has very little to do with web services and a lot to do with how a String is stored in Java. Java uses a char[] to back a String object. Since array elements are accessed with integer values, there can be as many elements as the max value of Integer , which is (2^31)-1 or 2147483647 .

In other words, you can, theoretically, your String value could use up to 2147483647 char values to be represented.

If your web service is going over HTTP, you will want to read any restrictions the HTTP specification might have the size of content, header values, and URLs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM