Method: Buildr::Jetty.bounce

Defined in:
lib/java/jetty.rb

.bounce(options) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/java/jetty.rb', line 18

def self.bounce(options)
  fu_check_options options, *OPTIONS
  options[:classpath] ||= []
  
  begin
    verbose { puts "Bouncing webapp #{options[:war_path]}" }
    res = jetty_call('/bounce', :post, options)
    verbose { puts "done." }
  rescue Errno::ECONNREFUSED => e
    puts "Web server not found, spawning it."
    runtool options.merge(:class=>"JettyWrapper",
                          :args=>[ options[:war_path], options[:context_path] ],
                          :classpath=>options[:classpath] + ['buildr/lib/java/jetty'])
  end

  case res
  when Net::HTTPNotFound
    fail "A web server seems to be already running without Buildr deployment hooks."
  when Net::HTTPInternalServerError
    fail "Server error occured when redeploying the WAR, see the web server logs."
  end
end