GlassFish and Ruby - Part II

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 !
Comments:

My first priority is to get our first production application running on Glassfish and JDK6 without LDAP-related file descriptor leaks, RoR is pretty far down the list.

Posted by Mikael Gueck on December 19, 2006 at 07:37 AM PST #

Post a Comment:
Comments are closed for this entry.
About

whacko

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today