问题
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