Can this be done?

What I want: I get a normal http request containing a URL from a remote
server.

Instead of redirecting to that URL, I want to load it into an iframe on
an existing page.

I’ve tried a number of approaches with no success.

Can anybody suggest a good way to do this? Alternatively, if you can say
“this is bloody impossible, because…”, that would be helpful, too.

–Al Evans

Al Evans wrote:

What I want: I get a normal http request containing a URL from a remote
server.

Instead of redirecting to that URL, I want to load it into an iframe on
an existing page.

I’ve tried a number of approaches with no success.

Can anybody suggest a good way to do this? Alternatively, if you can say
“this is bloody impossible, because…”, that would be helpful, too.

–Al Evans

Are you talking about a Websphere IFRAME? Or just using that
terminology. I am not being able to understand what you mean by “want
to load it into an iframe on an existing page”.

Please give details.

aj

On 7/20/06, Ajaya A. [email protected] wrote:

What I want: I get a normal http request containing a URL from a remote
server.

in “I get” are you the browser or server?

If you receive a request to <http://example.com/display/
remoteserver.com/remote page>

then you can use:

map.connect ‘display/:remote_url’, :controller =>
‘display’, :action => ‘index’

And in the rhtml do something like:

In reality, you’d want a function in the controller to make sure that
the remote url is legal.

        - dan


Dan K. mailto:[email protected]
http://www.dankohn.com/ tel:+1-415-233-1000

Dan K. wrote:

If you receive a request to <http://example.com/display/
remoteserver.com/remote page>

then you can use:

map.connect ‘display/:remote_url’, :controller =>
‘display’, :action => ‘index’

And in the rhtml do something like:

In reality, you’d want a function in the controller to make sure that
the remote url is legal.

Thanks, that works, as far as it goes. But I don’t seem to have been
quite clear on what I’m trying to do. Here’s the sequence:

  1. The user fills in a form and submits it.

  2. The app processes the data from that form, and a URL is built.

  3. The app does a redirect to that URL.

  4. The remote server send back a normal http request. The parameters may
    signify correct completion, failure, or a need for more data from the
    user.

  5. If the remote system needs more data, it sends along a URL for a form
    in which the user can provide that data. After he has done so, goto step

I am trying to make this look seamless, by handling the remote server’s
request for more data in an iframe. But so far, I haven’t been able to
master the flow of control, and keep everything happening on one (RJS
updated) page. In particular, I can’t figure out how to respond with an
RJS update when the remote server sends a normal http request.

I’m beginning to think I’m going about it all wrong, and it’s time for
some serious redesign. I have no control over the remote server or its
actions.

–Al Evans

There may be some level of Javascript magic to do what you want, but
I believe you are making this far harder than it should be.
Fundamentally, the web architecture was not designed to allow a
client to have asynchronous communications with two servers
simultaneously.

My first choice would be to simply redirect the user to the remote
server, and have them redirect them back to my server when they’re
done. This is, for example, how PayPal works.

If that’s unacceptable, I would consider having your server act as a
proxy between the client and the remote server. So, you pass through
the clients request to the remote server, and then parse that remote
server’s response and present it to the client. You can make
everything AJAXy for the user, but our server has direct control over
both sides.

In 4, I assume you meant to say: “The remote server send back a
normal http response.” You’d need to be more specific if you want
extra help.

        - dan


Dan K. mailto:[email protected]
http://www.dankohn.com/ tel:+1-415-233-1000

You might find
http://javathehutt.blogspot.com/2006/07/rails-realities-part-15-ajax-modal.htmlvery
useful.

On 7/21/06, Dan K. [email protected] wrote:

Dan K. mailto:[email protected]

Instead of redirecting to that URL, I want to load it into an

http://lists.rubyonrails.org/mailman/listinfo/rails


rm -rf / 2>/dev/null - http://null.in

“Things do not happen. Things are made to happen.” - JFK

Dan K. wrote:

There may be some level of Javascript magic to do what you want, but
I believe you are making this far harder than it should be.
Fundamentally, the web architecture was not designed to allow a
client to have asynchronous communications with two servers
simultaneously.

You’re right. I can do it with Javascript, or by doing some ugly major
surgery on ActionController, but I haven’t found any other way.

My first choice would be to simply redirect the user to the remote
server, and have them redirect them back to my server when they’re
done. This is, for example, how PayPal works.

That’s my current plan. All I have to do is figure out how to make it
look seamless.

In 4, I assume you meant to say: “The remote server send back a
normal http response.”

No, actually, it’s a normal GET. That’s the problem:-)

–Al Evans

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs