0

I'm currently trying to use MSF4J with the StreamingOutput API. However, instead of streaming a File, I want to stream a series of unending short strings/texts. I want the strings to be flushed to the client immediately. However, the client is not getting it after the flush. I believe it is due to the default 8kb buffer, because my strings get flushed after a while in chunks. How do I override this default buffer the same way it is done in glassfish? https://jersey.java.net/apidocs/2.22/jersey/org/glassfish/jersey/server/ServerProperties.html#OUTBOUND_CONTENT_LENGTH_BUFFER

I want something like...

Properties properties = new Properties()
properties.set("jersey.config.server.contentLength.buffer", 0);**

new MicroservicesRunner()
  .setProperties(properties)**
  .addInterceptor(new HTTPMonitoringInterceptor())
  .deploy(new MyService())
  .start();

My streamingout class

new StreamingOutput(){    
     public void write(OutputStream os) throws IOException, WebApplicationException      {
        while(true){
           os.write("some string".getBytes());
           os.flush();
        }    
      }
}

thank you.

Speng
  • 1
  • 2

0 Answers0