如何在球衣中使用嵌套的多部分/混合mime类型 [英] How to consume a nested multipart/mixed mime type in jersey
问题描述
我已经搜索了很长时间,但是没有答案.我希望有人能帮助我.
I have googled for a long time, but no answer. I hope someone can help me.
说,我在jersey服务器端收到了一个多部分/混合包,其结构如下:
Say, I received a multipart/mixed package in jersey server side, its structure looks like this:
multipart/mixed
|
|---Title: text/plain
|
|---Text content: text/plain
|
|---Image content: multipart/mixed
| |
| |--- Image name: text/plain
| |
| |--- Image body: image/jpeg
|
|.........
使用 bodypart.getEntityAs(Class clazz)方法可以轻松处理前两个bodypart.但是对于嵌套的多部分,我只能获得BodyPartEntity并通过它获得输入流.显然,通过输入流获取图像名称和图像主体并不容易. 那么,如何获得原始的多部分/混合类型实体,或者在球衣中处理嵌套的多部分/混合类型的正确方法是什么?
The first two bodypart can be easily processed by using bodypart.getEntityAs(Class clazz) method. But for the nested multipart, i can only get a BodyPartEntity and through it get an inputstream. Obviously, it is not easy getting the image name and image body through the inputstream. So, how can i get the original multipart/mixed entity or what is the right way to process the nested multipart/mixed type in jersey?
推荐答案
最后,我发现了错误.嵌套的多部分必须在标头中具有边界,并且与父代不相同.
finally i found the error. The nested multipart must have boundary in the header and not the same with the parent.
这篇关于如何在球衣中使用嵌套的多部分/混合mime类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!