How to consume a nested multipart/mixed mime type in jersey

会有一股神秘感。 提交于 2019-12-11 05:32:49

问题


I have googled for a long time, but no answer. I hope someone can help me.

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
   |
   |.........

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?


回答1:


finally i found the error. The nested multipart must have boundary in the header and not the same with the parent.



来源:https://stackoverflow.com/questions/16175597/how-to-consume-a-nested-multipart-mixed-mime-type-in-jersey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!