<?xml version="1.0" encoding="UTF-8"?>
<page>
  <created-at type="datetime">2008-08-12T19:54:28Z</created-at>
  <description></description>
  <id type="integer">155</id>
  <name>JRubyRack</name>
  <number type="integer">1</number>
  <person-id type="integer">34</person-id>
  <text>JRuby-Rack is a lightweight adapter for the Java servlet environment that allows any Rack-based application to run unmodified in a Java servlet container. JRuby-Rack supports Rails, Merb, as well as any Rack-compatible Ruby web framework.

For more information on Rack, visit http://rack.rubyforge.org.

__TOC__

==Download==

JRuby-Rack 0.9 is the first public release. Download it:

http://repository.codehaus.org/org/jruby/rack/jruby-rack/0.9/jruby-rack-0.9.jar

JRuby-Rack is also bundled with [http://caldersphere.rubyforge.org/warbler Warbler 0.9.9], which is available as a Ruby gem (&lt;tt&gt;jruby -S gem install warbler&lt;/tt&gt;).

==Features==

===Servlet Filter===

JRuby-Rack's main mode of operation is as a servlet filter. This allows requests for static content to pass through and be served by the
application server. Dynamic requests only happen for URLs that don't have a corresponding file, much like many Ruby applications expect.

===Goldspike-compatible Servlet===

JRuby-Rack includes a stub RailsServlet and recognizes many of Goldspike's context parameters (e.g., pool size configuration), making it
interchangeable with Goldspike, for convenience of migration. One caveat is that static content is served by Rack, which requires acquisition of
a JRuby runtime. Your throughput with static files will be much lower than when JRuby-Rack is configured as a servlet filter. You have been
warned!

===Servlet environment integration===

* Servlet context is accessible to any application both through the global variable $servlet_context and the Rack environment variable java.servlet_context.
* Servlet request object is available in the Rack environment via the key java.servlet_request.
* Servlet request attributes are passed through to the Rack environment.
* Rack environment variables and headers can be overridden by servlet request attributes.
* Java servlet sessions are used as the default session store for both Rails and Merb. Session attributes with String keys and String, numeric, boolean, or java object values are automatically copied to the servlet session for you.

===JRuby Runtime Management===

JRuby runtime management and pooling is done automatically by the framework. In the case of Rails, runtimes are pooled. For Merb and other Rack
applications, a single runtime is created and shared for every request.

==Feedback==

For simplicity, I haven't set up any separate mailing lists or bug trackers for jruby-rack at this time. Please use the [http://xircles.codehaus.org/lists/user@jruby.codehaus.org jruby-user mailing list] and the [http://jira.codehaus.org/browse/JRUBY JRuby JIRA issue tracker] for feedback.

==Source==

The source is currently available from the jruby-contrib subversion repository on codehaus:

http://svn.codehaus.org/jruby-contrib/trunk/rack

==Building==

Ensure you have JRuby with the buildr and rack gems installed.

  jruby -S gem install buildr rack

Checkout the JRuby Rack code and cd to that directory

  svn co http://svn.codehaus.org/jruby-contrib/trunk/rack
  cd rack

Resolve dependencies, compile the code, and build the jar file.

  jruby -S buildr package

The generated jar should be found in target/jruby-rack-*.jar.

'''NOTE''': The JRuby 1.1.3 release, which bundles Rubygems 1.2, [http://rubyforge.org/tracker/index.php?func=detail&amp;aid=21056&amp;group_id=126&amp;atid=575 has some problems with installing Buildr]. To that end I've prepared a standalone buildr package with JRuby 1.1.2. [http://caldersphere.net/jruby-rack/jruby-buildr.tar.gz Download it], add the jruby-buildr directory to your path, and use the jruby-buildr/buildr script instead of &quot;jruby -S buildr&quot; above.
</text>
  <text-as-html>&lt;p&gt;JRuby-Rack is a lightweight adapter for the Java servlet environment that allows any Rack-based application to run unmodified in a Java servlet container. JRuby-Rack supports Rails, Merb, as well as any Rack-compatible Ruby web framework.

&lt;/p&gt;&lt;p&gt;For more information on Rack, visit &lt;a class='external' href=&quot;http://rack.rubyforge.org.&quot;&gt;http://rack.rubyforge.org.&lt;/a&gt;

&lt;/p&gt;&lt;div id='toc' class='toc'&gt;
           &lt;div id='toctitle' class='toc-title'&gt;
             &lt;span&gt;Contents&lt;/span&gt;
           &lt;/div&gt;
           &lt;div id='toccontents' class='toc-contents'&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;1 &lt;a href='#Download'&gt;Download&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2 &lt;a href='#Features'&gt;Features&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;&lt;li&gt;2.1 &lt;a href='#Servlet_Filter'&gt;Servlet Filter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2.2 &lt;a href='#Goldspike-compatible_Servlet'&gt;Goldspike-compatible Servlet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2.3 &lt;a href='#Servlet_environment_integration'&gt;Servlet environment integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;2.4 &lt;a href='#JRuby_Runtime_Management'&gt;JRuby Runtime Management&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;3 &lt;a href='#Feedback'&gt;Feedback&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;4 &lt;a href='#Source'&gt;Source&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;5 &lt;a href='#Building'&gt;Building&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/ul&gt;&lt;/div&gt;
         &lt;/div&gt;&lt;p&gt;&lt;br /&gt;

&lt;/p&gt;&lt;h2&gt;&lt;a name='Download'&gt;&lt;/a&gt;Download&lt;/h2&gt;
&lt;p&gt;
JRuby-Rack 0.9 is the first public release. Download it:

&lt;/p&gt;&lt;p&gt;&lt;a class='external' href=&quot;http://repository.codehaus.org/org/jruby/rack/jruby-rack/0.9/jruby-rack-0.9.jar&quot;&gt;http://repository.codehaus.org/org/jruby/rack/jruby-rack/0.9/jruby-rack-0.9.jar&lt;/a&gt;

&lt;/p&gt;&lt;p&gt;JRuby-Rack is also bundled with &lt;a class='external' href=&quot;http://caldersphere.rubyforge.org/warbler&quot;&gt;Warbler 0.9.9&lt;/a&gt;, which is available as a Ruby gem (&lt;tt&gt;jruby -S gem install warbler&lt;/tt&gt;).

&lt;/p&gt;&lt;h2&gt;&lt;a name='Features'&gt;&lt;/a&gt;Features&lt;/h2&gt;
&lt;h3&gt;&lt;a name='Servlet_Filter'&gt;&lt;/a&gt;Servlet Filter&lt;/h3&gt;
&lt;p&gt;
JRuby-Rack's main mode of operation is as a servlet filter. This allows requests for static content to pass through and be served by the
application server. Dynamic requests only happen for URLs that don't have a corresponding file, much like many Ruby applications expect.

&lt;/p&gt;&lt;h3&gt;&lt;a name='Goldspike-compatible_Servlet'&gt;&lt;/a&gt;Goldspike-compatible Servlet&lt;/h3&gt;
&lt;p&gt;
JRuby-Rack includes a stub RailsServlet and recognizes many of Goldspike's context parameters (e.g., pool size configuration), making it
interchangeable with Goldspike, for convenience of migration. One caveat is that static content is served by Rack, which requires acquisition of
a JRuby runtime. Your throughput with static files will be much lower than when JRuby-Rack is configured as a servlet filter. You have been
warned!

&lt;/p&gt;&lt;h3&gt;&lt;a name='Servlet_environment_integration'&gt;&lt;/a&gt;Servlet environment integration&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt; Servlet context is accessible to any application both through the global variable $servlet_context and the Rack environment variable java.servlet_context.
&lt;/li&gt;&lt;li&gt; Servlet request object is available in the Rack environment via the key java.servlet_request.
&lt;/li&gt;&lt;li&gt; Servlet request attributes are passed through to the Rack environment.
&lt;/li&gt;&lt;li&gt; Rack environment variables and headers can be overridden by servlet request attributes.
&lt;/li&gt;&lt;li&gt; Java servlet sessions are used as the default session store for both Rails and Merb. Session attributes with String keys and String, numeric, boolean, or java object values are automatically copied to the servlet session for you.
&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;a name='JRuby_Runtime_Management'&gt;&lt;/a&gt;JRuby Runtime Management&lt;/h3&gt;
&lt;p&gt;
JRuby runtime management and pooling is done automatically by the framework. In the case of Rails, runtimes are pooled. For Merb and other Rack
applications, a single runtime is created and shared for every request.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Feedback'&gt;&lt;/a&gt;Feedback&lt;/h2&gt;
&lt;p&gt;
For simplicity, I haven't set up any separate mailing lists or bug trackers for jruby-rack at this time. Please use the &lt;a class='external' href=&quot;http://xircles.codehaus.org/lists/user@jruby.codehaus.org&quot;&gt;jruby-user mailing list&lt;/a&gt; and the &lt;a class='external' href=&quot;http://jira.codehaus.org/browse/JRUBY&quot;&gt;JRuby JIRA issue tracker&lt;/a&gt; for feedback.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Source'&gt;&lt;/a&gt;Source&lt;/h2&gt;
&lt;p&gt;
The source is currently available from the jruby-contrib subversion repository on codehaus:

&lt;/p&gt;&lt;p&gt;&lt;a class='external' href=&quot;http://svn.codehaus.org/jruby-contrib/trunk/rack&quot;&gt;http://svn.codehaus.org/jruby-contrib/trunk/rack&lt;/a&gt;

&lt;/p&gt;&lt;h2&gt;&lt;a name='Building'&gt;&lt;/a&gt;Building&lt;/h2&gt;
&lt;p&gt;
Ensure you have JRuby with the buildr and rack gems installed.

&lt;/p&gt;&lt;pre&gt;  jruby -S gem install buildr rack
&lt;/pre&gt;&lt;p&gt;
Checkout the JRuby Rack code and cd to that directory

&lt;/p&gt;&lt;pre&gt;  svn co &lt;a class='external' href=&quot;http://svn.codehaus.org/jruby-contrib/trunk/rack&quot;&gt;http://svn.codehaus.org/jruby-contrib/trunk/rack&lt;/a&gt;
  cd rack
&lt;/pre&gt;&lt;p&gt;
Resolve dependencies, compile the code, and build the jar file.

&lt;/p&gt;&lt;pre&gt;  jruby -S buildr package
&lt;/pre&gt;&lt;p&gt;
The generated jar should be found in target/jruby-rack-*.jar.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;NOTE&lt;/b&gt;: The JRuby 1.1.3 release, which bundles Rubygems 1.2, &lt;a class='external' href=&quot;http://rubyforge.org/tracker/index.php?func=detail&amp;aid=21056&amp;group_id=126&amp;atid=575&quot;&gt;has some problems with installing Buildr&lt;/a&gt;. To that end I've prepared a standalone buildr package with JRuby 1.1.2. &lt;a class='external' href=&quot;http://caldersphere.net/jruby-rack/jruby-buildr.tar.gz&quot;&gt;Download it&lt;/a&gt;, add the jruby-buildr directory to your path, and use the jruby-buildr/buildr script instead of &amp;quot;jruby -S buildr&amp;quot; above.
&lt;/p&gt;</text-as-html>
  <updated-at type="datetime">2008-08-12T19:54:28Z</updated-at>
  <wiki-id type="integer">320</wiki-id>
</page>
