java - Streaming HTTP responses with Jetty AsyncProxyServlet -


i have server streams various things such log output on long-lived http responses. however, when using jetty's proxy servlets, haven't been able stream response (it buffers whole response before sending).

using overriding plain proxyservlet class, following appears work:

@override protected void onresponsecontent(httpservletrequest request, httpservletresponse response, response proxyresponse, byte[] buffer, int offset, int length, callback callback) {     super.onresponsecontent(request, response, proxyresponse, buffer, offset, length, callback);     try {         response.getoutputstream().flush();     } catch (ioexception e) {         log.warn("error flushing", e);     } } 

however, doing when overriding asyncproxyservlet doesn't work. (full source code here.)

so, 2 questions:

  1. when using proxyservlet, flushing after each bit of content received way go?
  2. is there way make work asyncproxyservlet?

got working. proper approach works whether async used or not, set output buffer size when creating jetty server connectors.

httpconfiguration httpconfig = new httpconfiguration(); httpconfig.setoutputbuffersize(1024); serverconnector httpconnector = new serverconnector(jettyserver,         new httpconnectionfactory(httpconfig)); 

the default 32768.

(note: no need override onresponsecontent method)


Comments

Popular posts from this blog

php - Autoloader issue not returning Class -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

C++ Program To Find Smallest and Largest Number In Array -