dev@grizzly.java.net

Re: Patch to fix the Dynamic request processing for a ROR application deployed at root contet

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 14 Feb 2008 12:59:12 -0500

Hi Pramod,

patch applied. Next time can you file an issue and attach the fix to it?
That way we have a better tracking of what we are adding :-)

Thanks!

--Jeanfrancois

Pramod Gopinath wrote:
> Hi
> Sending in a patch to fix an issue that I ran into when trying to
> deploy a ROR application inside the GlassFish V3 server.
> The issue was that if I had the application deployed on the root context
> the static files were working correctly, but the dynamic requests -
> controller/action were not working correctly. This had to do with the
> "ActionController::<Abstract/Cgi>Request." settings that were defined in
> the dispatch.rb.
> These settings are only required if the application is not at the root
> context.
>
> Have checked this with JRuby 1.0.3, JRuby 1.1RC and trunk bits using
> mephisto application.
>
> Thanks
> Pramod Gopinath
>
>
> svn diff resources/dispatch.rb java/com/sun/grizzly/jruby/RailsAdapter.java
> Index: resources/dispatch.rb
> ===================================================================
> --- resources/dispatch.rb (revision 798)
> +++ resources/dispatch.rb (working copy)
> @@ -55,8 +55,11 @@
> ENV['HTTP_' + name.upcase.tr('-','_')] = value
> end
>
> -ActionController::AbstractRequest.relative_url_root = $root
> -ActionController::CgiRequest.relative_url_root = $root
> +if !$root.nil?
> + ActionController::AbstractRequest.relative_url_root = $root
> + ActionController::CgiRequest.relative_url_root = $root
> +end
> +
> require "dispatcher"
>
> Dispatcher.dispatch
> Index: java/com/sun/grizzly/jruby/RailsAdapter.java
> ===================================================================
> --- java/com/sun/grizzly/jruby/RailsAdapter.java (revision 798)
> +++ java/com/sun/grizzly/jruby/RailsAdapter.java (working copy)
> @@ -106,8 +106,8 @@
> runtime.defineReadonlyVariable("$stdin", iObj);
> runtime.defineReadonlyVariable("$stdout", oObj);
> runtime.defineReadonlyVariable("$logger", loggerObj);
> - - if (contextRoot!=null) {
> +
> + if (contextRoot!=null && !contextRoot.equals("/")) {
> runtime.defineReadonlyVariable("$root",
> JavaEmbedUtils.javaToRuby(runtime, contextRoot));
> }
> pramod-gopinaths-computer:~/work_related/grizzly_code/grizzly/trunk/modules
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>