wso2 msf4j:如何配置服务器属性

时间:2017-02-14 09:03:25

标签: wso2 msf4j

我目前正在尝试将MSF4J与StreamingOutput API一起使用。但是,我想要流式传输一系列无休止的短字符串/文本,而不是流式传输文件。我希望立即将字符串刷新到客户端。但是,客户端在刷新后没有得到它。我相信这是由于默认的8kb缓冲区,因为我的字符串在一段时间内被刷新了。如何覆盖此默认缓冲区的方式与在glassfish中完成相同? https://jersey.java.net/apidocs/2.22/jersey/org/glassfish/jersey/server/ServerProperties.html#OUTBOUND_CONTENT_LENGTH_BUFFER

我想要类似......

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

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

我的流媒体课程

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

0 个答案:

没有答案