| Author |
Message |
|
| Guest |
Posted: Mon Apr 28, 2008 11:15 am |
|
|
|
Guest
|
Hi,
I just wanted to put session handling routine in the hook method of
app_controler and I stuck on the following problem.
I want to set cookie and continue to render components.
To achieve this I do the following:
....
CC = yaws_api:setcookie("testme", pid_to_list(P), "/"),
{response, [CC, {body, {ewc, A}}]}.
unfortunately if I make it like this cookie is not set.
However if I change last line to
{response, [CC]}.
cookie is set, but of course further rendering is not continued.
What do I do wrong?
thanks,
Artur
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Tue Apr 29, 2008 9:32 pm |
|
|
|
Guest
|
Just found a solution:
{response, [{redirect, "/"}, CC]};
Instead of "/" should be of course the proper path.
cheers,
Artur
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Mon May 05, 2008 3:39 am |
|
|
|
Guest
|
This should work if you return the following from the app controller:
{phased, {ewc, A},
fun(_Ewc, Data, _Vars) ->
CC = yaws_api:setcookie("testme", pid_to_list(P), "/"),
{response, [CC | {body, {ewc, html_container, [A, Data]}}]}
end}
If the requested component doesn't return a redirect, its results are
put in html_container and returned together with the cookie.
Yariv
On Mon, Apr 28, 2008 at 4:14 AM, Smok <smok.telesfor@gmail.com> wrote:
>
> Hi,
>
> I just wanted to put session handling routine in the hook method of
> app_controler and I stuck on the following problem.
> I want to set cookie and continue to render components.
> To achieve this I do the following:
>
> ....
> CC = yaws_api:setcookie("testme", pid_to_list(P), "/"),
> {response, [CC, {body, {ewc, A}}]}.
>
> unfortunately if I make it like this cookie is not set.
>
> However if I change last line to
> {response, [CC]}.
>
> cookie is set, but of course further rendering is not continued.
>
> What do I do wrong?
>
> thanks,
> Artur
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed May 07, 2008 3:14 pm |
|
|
|
Guest
|
Wanted to try it but another problem appeared.
In my test application this hook return works fine:
{phased, {ewc, A},
fun(_Ewc, Data, _Vars) ->
{ewc, html_container, [A, {data, Data}]}
end}
however if I try it in this way:
{phased, {ewc, A},
fun(_Ewc, Data, _Vars) ->
{response, [{body, {ewc, html_container, [A, {data, Data}]}}]}
end}
I get error stating that this response value is invalid "Response
values other then 'data' and 'ewc' tuples must...".
What can be wrong here?
thanks,
Artur
On 5 Maj, 05:39, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> This should work if you return the following from the app controller:
>
> {phased, {ewc, A},
> fun(_Ewc, Data, _Vars) ->
> CC = yaws_api:setcookie("testme", pid_to_list(P), "/"),
> {response, [CC | {body, {ewc, html_container, [A, Data]}}]}
> end}
>
> If the requested component doesn't return a redirect, its results are
> put in html_container and returned together with the cookie.
>
> Yariv
>
> On Mon, Apr 28, 2008 at 4:14 AM, Smok <smok.teles...@gmail.com> wrote:
>
> > Hi,
>
> > I just wanted to put session handling routine in the hook method of
> > app_controler and I stuck on the following problem.
> > I want to set cookie and continue to render components.
> > To achieve this I do the following:
>
> > ....
> > CC = yaws_api:setcookie("testme", pid_to_list(P), "/"),
> > {response, [CC, {body, {ewc, A}}]}.
>
> > unfortunately if I make it like this cookie is not set.
>
> > However if I change last line to
> > {response, [CC]}.
>
> > cookie is set, but of course further rendering is not continued.
>
> > What do I do wrong?
>
> > thanks,
> > Artur
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---
Post received from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|