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 Y.
I think u r asking about redirect_to
Maurice Y. 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 Y.
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
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,
Selvaraj
Thanks for your response…
Maurice
On 12/11/06, Maurice Y. [email protected] wrote:
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 Y.
A pretty close equivalent of this would be render_component, but
components add significant overhead and are slated to be deprecated.
–
Kent