如何在Java Servlet中接收一个大字符串?

huangapple go评论62阅读模式
英文:

How can I receive a large string in Java Servlet?

问题

我正在构建一个JSP应用程序。我试图通过使用base64编码将页面上的屏幕截图图像发送到Servlet。这使得返回的字符串长度超长,达到了100k个字符长度。因此,当我将其发布到Servlet并使用getParameter时,我在那里获取到null。

有没有一种方法可以分块获取它们,还是我漏掉了什么?

英文:

I am building a JSP application. I am trying to send an screenshot image from the page to the servlet by using base64 encoding. It makes the returning string super long with 100k characters length. So when I post this to the servlet and with getParameter, I am getting null there.

Is there a way to get them by chunks are am I missing something?

答案1

得分: 1

我发现这对你可能有用。

链接:https://stackoverflow.com/questions/36734311/passing-a-huge-string-as-post-parameter-to-a-servlet

Namit Rana:

我们使用了GZip压缩/解压缩来降低字符串的大小。这样做效果很好。

因此,.net服务对大字符串进行了压缩,将其发送到我们的Servlet。然后我们在服务器上对其进行解压缩。

英文:

I found this maybe useful for you.

https://stackoverflow.com/questions/36734311/passing-a-huge-string-as-post-parameter-to-a-servlet

Namit Rana:

We used GZip compression/decompression to lower the size of the string. And it worked effectively.

So, the .net service compressed the huge string, sent it to our Servlet. We then decompress it at our server.

huangapple
  • 本文由 发表于 2020年9月25日 11:01:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/64057192.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定