Serialize Java 8 Stream with Jersey
问题 How can I serialize a Java 8 java.util.Stream<T> with Jersey. I tried to write a MessageBodyWriter , but I need to know how to compose (decorate) existing MessageBodyWriters with a new MessageBodyWriter for my Stream . Stream<String> get(){ return some stream of strings } public <T> class StreamMessageBodyWriter<Stream<T>> implements MessageBodyWriter<Stream<T>> { public void writeTo(.......){ //How can I get the handle to MessageBodyWriter that will write for type T, //so that I can 'collect