url rewrite (http 304) with seaside / pharo 3

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

url rewrite (http 304) with seaside / pharo 3

nova
Hi,

I an new to seaside and playing with it. When a session is started I
want to make a url check and if it fits some conditions to do an url
rewrite (http 304).

I think I found the place where to make this check: initialRequest:
But I can't find how to send a url rewrite back (I don't want to use an
external http-server for that rewrite).

Any help will be appreciated :)

P.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: url rewrite (http 304) with seaside / pharo 3

Johan Brichau-2
Hi,

You can take a look at the implementation of the #testRedirectTo method in the Core tests.
The WAResponse object has methods you will want to use: #redirectTo: , #movedPermanently, etc...
When you find senders of these methods, you can see how to make a redirection response. Something along the lines of:

self requestContext respond: [:response | response movedPermanently; redirectTo: url]

I think this should work in the #initialRequest: method as well, but let me know if it does not.

Johan

On 10 Sep 2014, at 00:43, nova <[hidden email]> wrote:

> Hi,
>
> I an new to seaside and playing with it. When a session is started I
> want to make a url check and if it fits some conditions to do an url
> rewrite (http 304).
>
> I think I found the place where to make this check: initialRequest:
> But I can't find how to send a url rewrite back (I don't want to use an
> external http-server for that rewrite).
>
> Any help will be appreciated :)
>
> P.
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: url rewrite (http 304) with seaside / pharo 3

Philippe Marschall
In reply to this post by nova
On Wed, Sep 10, 2014 at 12:43 AM, nova <[hidden email]> wrote:

> Hi,
>
> I an new to seaside and playing with it. When a session is started I
> want to make a url check and if it fits some conditions to do an url
> rewrite (http 304).
>
> I think I found the place where to make this check: initialRequest:
> But I can't find how to send a url rewrite back (I don't want to use an
> external http-server for that rewrite).
>
> Any help will be appreciated :)

You could also subclass WAApplication and override
#handle:registering:at: or use WARestfulComponentFilter and redirect
before creating a session. If you explain the problem you're trying to
solve in more detail we may be able to help you better.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: url rewrite (http 304) with seaside / pharo 3

nova
In reply to this post by Johan Brichau-2
Thanks for your hints... this is the final method to do the redirect:


        initialRequest: aRequest

        "some conditions..."
                ifTrue: [ self requestContext redirectTo:
                '/Testurl/AAA' ]

I hope this is conform with good seaside style....

P.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside