How to obtain the context path in a Jruby app on Tomcat?

Hi all,
I successfully deployed my JRuby on Rails app on Tomcat
In a jsp page I’d use ${pageContext.request.contextPath} to obtain my
context path.How could I do this in a Ruby controller?

Thanks
Rafael R.

On Thu, Oct 29, 2009 at 11:01 AM, Rafael R. <
[email protected]> wrote:

Hi all,
I successfully deployed my JRuby on Rails app on Tomcat
In a jsp page I’d use ${pageContext.request.contextPath} to obtain my
context path.How could I do this in a Ruby controller?

Thanks
Rafael R.

What does the context path represent within JSP?

-Conrad

Try R…public_path

On Thu, Oct 29, 2009 at 12:01 PM, Rafael R.
[email protected] wrote:

Hi all,
I successfully deployed my JRuby on Rails app on Tomcat
In a jsp page I’d use ${pageContext.request.contextPath} to obtain my
context path.How could I do this in a Ruby controller?

JRuby-Rack exposes a controller method called #servlet_request. So you
could try servlet_request.context_path inside a controller or view.

/Nick