In
part I, a
GlassFish server was dedicated to hosting a single RoR application running on a native Ruby interpreter.
Starting with changes in
build 29,
GlassFish v2 is capable of hosting multiple RoR applications along with your other web/ejb applications. All you need to do is make a couple of minor tweaks
-
Specify the context root associated with the RoR application in the descriptor file and the 'stripRequestURI' initialization paramater along with others specified in part I as illustrated below.
<servlet>
<servlet-name>cgi</servlet-name>
<servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
...
<init-param>
<-- stripRequestURI parameter value maps to context root -->
<-- in this case - http://.../ror/${ror-request-URI} -->
<param-name>stripRequestURI</param-name>
<param-value>/ror/</param-value>
<init-param>
...
</servlet>
<servlet-mapping>
<servlet-name>cgi</servlet-name>
<url-pattern>/ror/*</url-pattern>
</servlet-mapping>
-
Since Rails auto-generates links, you'll have to make the following change in config/routes.rb
# Specify the context root as the relative URL for all requests
ActionController::AbstractRequest.relative_url_root = "/ror"
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'
Rails application will be accessible @ http(s)://.../ror/...
Simply replicate the configuration with the customized value of context root and the 'cgiPathPrefix' initialization parameter pointing to each application's specific 'dispatch.cgi' to host multiple RoR applications !
Posted by Mikael Gueck on December 19, 2006 at 03:37 PM PST #