英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论