简体   繁体   English

JSONRequest Java中的Base64字符串

[英]Base64 String in JSONRequest Java

I'm handling a Web Service and need some help. 我正在处理Web服务,需要一些帮助。 The process is that a pdf will be encoded with base64 and sent to my web service. 该过程是将pdf用base64编码并发送到我的Web服务。 I will then decode it back into a pdf and place it in the appropriate folder. 然后,我将其解码回pdf,并将其放置在适当的文件夹中。 The issue is that the request needs to contain the actual giant base64 string. 问题是该请求需要包含实际的巨型base64字符串。 First question is is this possible. 第一个问题是这可能吗。 Second, I am using postman to make the requests and was wondering how to even copy the base64 string into it. 其次,我正在使用邮递员发出请求,并且想知道如何将base64字符串复制到其中。 It seems there's a string limit. 似乎有一个字符串限制。 Any help would be greatly appreciated. 任何帮助将不胜感激。

I don't know about postman but I can suggest to use JAX-RS and implement a ReaderInterceptor and a WriterInterceptor using Base64.Decoder#wrap respectively Base64.Encoder#wrap . 我不知道邮递员,但我建议使用JAX-RS并分别使用Base64.Decoder#wrapBase64.Encoder#wrap来实现ReaderInterceptorWriterInterceptor

Otherwise, maybe postman has similar features? 否则,也许邮递员具有类似的功能?

Use streams like these as much as possible to reduce memory usage. 尽可能使用此类流以减少内存使用量。

Tutorial: https://jersey.java.net/documentation/latest/filters-and-interceptors.html#d0e9806 教程: https//jersey.java.net/documentation/latest/filters-and-interceptors.html#d0e9806

Alright it just seems to be an issue with Postman. 好吧,这似乎是邮递员的问题。 When you place a string of that size it will give you errors and only put a certain length per line. 当您放置该大小的字符串时,它将给您带来错误,并且每行仅放置一定长度。 It will still receive the entire string. 它将仍然接收整个字符串。 I am able to receive it and decode it. 我能够接收它并对其进行解码。 Thank you all for your help! 谢谢大家的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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