index.txt

Path: website/index.txt
Last Update: Wed Jun 24 22:06:28 -0300 2009

h1. Jetty Rails

h1. → ‘jetty-rails‘

h2. What

See the "what is included":rdoc/files/History_txt.html in the last version.

Jetty Rails aims to run Ruby on Rails and Merb applications with the Jetty Container, leveraging the power of JRuby and jruby-rack.

"Jetty":jetty.mortbay.com/jetty/ is an excellent Java Web Server, being and at the same time extremely lightweight. This makes jetty-rails a good alternative for JRuby on Rails or Merb development and deployment.

The project has born from my own needs ("read more":fabiokung.com/2008/05/14/jetty-rails-gem-simple-jruby-on-rails-development-with-servlet-containers/). I needed to run "JForum":jforum.net on the same context of my jruby on rails application. I had also to integrate @HttpSessions@ (avoiding single sign on) and use @ServletContext@ in-memory cache store.

h2. Installing

<pre>jruby -S gem install jetty-rails</pre>

h2. The basics

Jetty Rails uses Jetty Handlers to dispatch requests to the "JRuby Rack adapter":wiki.jruby.org/wiki/JRuby_Rack.

All extra jars inside your application lib/ dir will be loaded. Things like Java @HttpSession@, @ServletContext@ and Runtime Pools are given by JRuby Rack Filter.

Additionally, Jetty Rails automatically puts classes inside the classes/ dir in the application classpath, so you can use them in your rails code.

h2. Demonstration of usage

Rails: <pre> cd myrailsapp jruby -S jetty_rails </pre>

Merb: <pre> cd mymerbapp jruby -S jetty_merb </pre>

[Validate]