Maurice Yarrow
2006-Dec-12 02:49 UTC
Rails equivalent to J2EE getRequestDispatcher().forward(...) or PHP @readfile(...)
Hello Rails community Is there a Rails equivalent to the J2EE getRequestDispatcher().forward(...) or the getRequestDispatch().include(...), or, say, the PHP @readfile(...) ? In particular, what I would like to do is first authenticate for permission, and if permitted, serve static content. The J2EE forward and include mechanisms allow content to be served without the service URL showing up in the URL bar in the client browser. This means that the original request can contain necessary static content location information, but after permission is ascertained, the full path to the content is assembled and passed only internally within the server. Maurice Yarrow --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Selvaraj Subbaian
2006-Dec-12 04:32 UTC
Re: Rails equivalent to J2EE getRequestDispatcher().forward(
I think u r asking about redirect_to Maurice Yarrow wrote:> Hello Rails community > > Is there a Rails equivalent to the J2EE > getRequestDispatcher().forward(...) or > the getRequestDispatch().include(...), or, > say, the PHP @readfile(...) ? > > In particular, what I would like to do is first authenticate > for permission, and if permitted, serve static content. > The J2EE forward and include mechanisms allow content > to be served without the service URL showing up in the > URL bar in the client browser. This means that the original > request can contain necessary static content location > information, but after permission is ascertained, the full > path to the content is assembled and passed only internally > within the server. > > Maurice Yarrow-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Johnpg
2006-Dec-12 04:38 UTC
Re: Rails equivalent to J2EE getRequestDispatcher().forward(...) or PHP @readfile(...)
It sounds like you want to do a reverse proxy. I do recall someone on the Rails wiki posting some code to do that. However I''d be hesitant to do it for real unless you had just a few things you wanted to protect/expose. If your Rails app is the main application and you just want to expose some back end static content for authenticated users then the wiki solution should work fine. Any more than that then I''d recommend investigating a real reverse proxy solution and have your apps and content sit behind that and let it take care of authentication. Cheers, John --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Kent Sibilev
2006-Dec-12 05:01 UTC
Re: Rails equivalent to J2EE getRequestDispatcher().forward(...) or PHP @readfile(...)
On 12/11/06, Maurice Yarrow <yarrow-6u10zFskWOU@public.gmane.org> wrote:> > Hello Rails community > > Is there a Rails equivalent to the J2EE > getRequestDispatcher().forward(...) or > the getRequestDispatch().include(...), or, > say, the PHP @readfile(...) ? > > In particular, what I would like to do is first authenticate > for permission, and if permitted, serve static content. > The J2EE forward and include mechanisms allow content > to be served without the service URL showing up in the > URL bar in the client browser. This means that the original > request can contain necessary static content location > information, but after permission is ascertained, the full > path to the content is assembled and passed only internally > within the server. > > Maurice YarrowA pretty close equivalent of this would be render_component, but components add significant overhead and are slated to be deprecated. -- Kent --- http://www.datanoise.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Johnpg
2006-Dec-12 05:45 UTC
Re: Rails equivalent to J2EE getRequestDispatcher().forward(...) or PHP @readfile(...)
After seeing the other replies I realize that I misunderstood what you were saying. The talk of URLs made me think the static content was on a different web server. But I think you mean you have static content outside the document root that you want to serve to clients that you first authenticate via your rails app. That''s easier. :-) Try send_file, http://api.rubyonrails.org/classes/ActionController/Streaming.html#M000072 --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---