jruby-rack-standalone-jetty
Provides a way to run jruby-rack with an embedded jetty, no WAR files or separate servlet container needed. You simply write a launcher script that contains code like this:
require 'jetty-runner'
jetty_options = {
:host => 'localhost',
:port => 4567,
# jruby-rack context parameters:
'jruby.rack.layout_class' => 'RailsFilesystemLayout',
'gem.path' => '.',
'rackup' => IO.read('config.ru')
}
server = JettyRunner.new(jetty_options)
server.run
server.join The options hash supports all jruby-rack context parameters.
Supported Jetty options:
-
:hostThe IP to bind to.localhostby default. -
:portThe port to use. If not specified then Jetty will use a random one. -
:use_nioWhether to use NIO instead of blocking IO for HTTP (does not affect HTTPS).trueby default -
:min_threadsThe minimum number of threads. 10 by default. -
:max_threadsThe maximum number of threads. 200 by default. -
:low_threadsThe number of threads that are considered to be low. 50 by default. -
:accept_queue_sizeThe number of requests to be allowed in the accept queue. Uses the value of:max_threadsby default. -
:ssl_portThe HTTPS port. If not specified (along with:keystoreand:key_password) then HTTPS will not be enabled. -
:keystoreThe keystore. If not specified (along with:ssl_portand:key_password) then HTTPS will not be enabled. -
:key_passwordThe password for the key in the keystore. If not specified (along with:ssl_portand:keystore) then HTTPS will not be enabled. -
:keystore_typeThe type of the keystore.JKSby default. -
:with_statsWhether to enable Jetty statistics and expose them via JMX.trueby default. -
:request_logThe request log object to use (must implementorg.mortbay.jetty.RequestLog). If neither this nor:request_log_pathare specified, then request logging will not be enabled. -
:request_log_pathThe path where theNCSARequestLogshould log to. If neither this nor:request_logare specified, then request logging will not be enabled. -
:resource_baseBase folder for resolving resources (such asconfig.ru). Default is..
Dependencies
This library requires that jetty 6.1.x and jruby-rack are in the classpath (it does not bundle them).