Module: Buildr::Jetty
- Defined in:
- lib/java/jetty.rb
Defined Under Namespace
Classes: JettyTask
Constant Summary collapse
- VERSION =
"6.1.1"
- REQUIRES =
[ "org.mortbay.jetty:jetty:jar:#{VERSION}", "org.mortbay.jetty:jetty-util:jar:#{VERSION}", "org.mortbay.jetty:servlet-api-2.5:jar:#{VERSION}", "log4j:log4j:jar:1.2.13", "commons-logging:commons-logging:jar:1.1" ]
- OPTIONS =
[ :classpath, :war_path, :context_path, :noop, :base_url, :process_alias ]
Class Method Summary collapse
Class Method Details
.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 [:classpath] ||= [] begin verbose { puts "Bouncing webapp #{[:war_path]}" } res = jetty_call('/bounce', :post, ) verbose { puts "done." } rescue Errno::ECONNREFUSED => e puts "Web server not found, spawning it." runtool .merge(:class=>"JettyWrapper", :args=>[ [:war_path], [:context_path] ], :classpath=>[: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 |
.jetty_call(rel_url, get_post, options) ⇒ Object
41 42 43 44 45 |
# File 'lib/java/jetty.rb', line 41 def self.jetty_call(rel_url, get_post, ) base_url = URI.parse(([:base_url] || 'http://localhost:8080/buildr') + rel_url) req = get_post == :post ? Net::HTTP::Post.new(base_url.path) : Net::HTTP::Get.new(base_url.path) res = Net::HTTP.start(base_url.host, base_url.port) {|http| http.request(req) } end |