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

View: New views
4 Messages — Rating Filter:   Alert me  

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

by Adam Akhtar-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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 Roque
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


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

by Justin Coyne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Try Rails.public_path

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


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

by Conrad Taylor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Oct 29, 2009 at 11:01 AM, Rafael Roque <rails-mailing-list@...> 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 Roque

What does the context path represent within JSP?

-Conrad
 
--
Posted via http://www.ruby-forum.com/.




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


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

by Nick Sieger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Thu, Oct 29, 2009 at 12:01 PM, Rafael Roque
<rails-mailing-list@...> 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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---