title: Serialize Java 8 Stream with Jersey
body: <p>How can I serialize a Java 8 <code>java.util.Stream&lt;T&gt;</code> with Jersey. I tried to write a <code>MessageBodyWriter</code>, but I need to know how to compose (decorate) existing <code>MessageBodyWriters</code> with a new <code>MessageBodyWriter</code> for my <code>Stream</code>.</p>
  
  <pre><code>Stream&lt;String&gt; get(){
    return some stream of strings  
  }
  
  public &lt;T&gt; class StreamMessageBodyWriter&lt;Stream&lt;T&gt;&gt; 
             implements MessageBodyWriter&lt;Stream&lt;T&gt;&gt; {
  
    public void writeTo(.......){
      //How can I get the handle to MessageBodyWriter that will write for type T, 
      //so that I can 'collect' the 'java.util.Stream&lt;T&gt;' and write it to 
      //OutputStream
    }
  }
  </code></pre>