jruby / jruby-rack

Rack for JRuby and Java appservers
MIT License
397 stars 137 forks source link

Sinatra stream helper doesn't work #161

Closed rafaeldff closed 11 years ago

rafaeldff commented 11 years ago

I have the following sinatra route:

get '/foobar' do
  stream do |out|
    out << "1"
    sleep 10
    out << "2"
    sleep 10
    out << "3"
  end
end

Generating the war file via warbler with jruby-rack, deploying to jetty, and testing with curl will result in the entire request being blocked for 20 seconds and the outputting "123" immediately after. I hoped to see "1", then "2" after ten seconds, and "3" ten seconds after that.

jruby-rack is 1.1.13.2 sinatra is 1.4.3 jetty is 9.0.4

rafaeldff commented 11 years ago

Sorry, just realized I needed to print newlines ("\n") to force the web server to flush the response buffer.