an http proxy (of a type)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

an http proxy (of a type)

Flynch55
Hi,

I have a Seaside app called CPTester.  What I would like to do is when the user enters "http://localhost:7777/CPTester" that my app would go off to another url (www.yahoo.com for example) and then respond with whatever was returned from yahoo.com.

I have the following code:

renderContentOn: html

        | cl reply |
        cl := Net.HttpClient new.
        reply := cl get: 'http://www.yahoo.com'.

        html context document initializeWithStream: reply value source codec: nil.


but I am getting messed up on how to supply the value for codec.  Also is this the correct approach or is there a simpler way.

Any help or pointers would be appreciated.

Thanks,
Frank
Reply | Threaded
Open this post in threaded view
|

Re: an http proxy (of a type)

Julian Fitzell-4
Hi Frank,

What version of Seaside are you using?

Reinitializing an object looks strange, so I doubt that's the right way.
What you probably want to do is create/modify the Response directly. In the
latest Seaside, this would be:

self requestContext respond: [ :response | "modify the response here" ].

In 2.8, it was something like:

self session returnResponse: "create a response here".

2.6 was probably the same as 2.8, but I don't remember.

Julian


On 11-05-25 9:16 PM, "Flynch55" <[hidden email]> wrote:

> Hi,
>
> I have a Seaside app called CPTester.  What I would like to do is when the
> user enters "http://localhost:7777/CPTester" that my app would go off to
> another url (www.yahoo.com for example) and then respond with whatever was
> returned from yahoo.com.
>
> I have the following code:
>
> renderContentOn: html
>
> | cl reply |
> cl := Net.HttpClient new.
> reply := cl get: 'http://www.yahoo.com'.
>
> html context document initializeWithStream: reply value source codec: nil.
>
>
> but I am getting messed up on how to supply the value for codec.  Also is
> this the correct approach or is there a simpler way.
>
> Any help or pointers would be appreciated.
>
> Thanks,
> Frank
>
> --
> View this message in context:
> http://forum.world.st/an-http-proxy-of-a-type-tp3550893p3550893.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc