flash.get('key') get nothing

393 views
Skip to first unread message

Ma Fai (gmail.com)

unread,
Apr 13, 2010, 4:47:40 AM4/13/10
to play-framework
Hi Devs:

I guess the flash is done by Cookie.

I do the following.


1. @Before annotation in controller, do the secure check and call
flash.put("url", request.url").
2. Do the auth, and say flash.keep("url"), render the login page
3. When submit the login form, I call flash.get("url"). In this step,
the flash can not get the "url".
The url will be used in Controller.redirect(url).

I check the YABE example, I can not find the difference for the
workflow.

Is my understanding wrong? very curious for me.

Ma Fai (gmail.com)

unread,
Apr 14, 2010, 1:39:29 AM4/14/10
to play-framework
Hi Devs:

I use the firebug, the Play response contains the PLAY_FLASH.
While the next request from firefox would not contains the PLAY_FLASH.
The next response also do not include PLAY_FLASH.

Any one know the reason?

Ivan Meredith

unread,
Apr 14, 2010, 2:00:51 AM4/14/10
to play-fr...@googlegroups.com
Maybe you want to use session instead of flash? I believe session uses
the cookies, and flash does not. Or you could include the url as a
hidden field in the form.

2010/4/14 Ma Fai (gmail.com) <maf...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>

Ma Fai (gmail.com)

unread,
Apr 14, 2010, 2:14:22 AM4/14/10
to play-framework
Let me make more description.

I check the secure models that using flash to record the url instead
of the hidden field.
The model is include in 1.02 as default. It can turn on by
application.conf.

As below, I found that, in the secure login.html template, there is no
variables like flash.get("url") also no hidden field "url".
How the authenticate or login method get the url?

Actually, in http response request, I can see response header after I
call flash.keep("url").

Set-Cookie: PLAY_FLASH=%00url%3A%2.......

So I will assume the flash also done by cookie tech. Am I wrong?


Secure.java
checkAccess(){
flash.put("url", request.url); #Here use flash to save the
url
#Call login method
...
}

login(){
#Do auth check
#if auth pass, call redirect method
# if not pass
flash.keep("url");
render();#render login page
}
redirect(){
String url = flash.get("url")
redirect(url)
}


On 4月14日, 下午2时00分, Ivan Meredith <i...@ivan.net.nz> wrote:
> Maybe you want to use session instead of flash? I believe session uses
> the cookies, and flash does not. Or you could include the url as a
> hidden field in the form.
>

> 2010/4/14 Ma Fai (gmail.com) <mafa...@gmail.com>:

Guillaume Bort

unread,
Apr 14, 2010, 5:57:35 AM4/14/10
to play-fr...@googlegroups.com
Yes flash values are stored in cookies. But they are stored only for
the next request. Maybe the cause of your problem.

2010/4/14 Ma Fai (gmail.com) <maf...@gmail.com>:

Ma Fai (gmail.com)

unread,
Apr 20, 2010, 9:34:40 PM4/20/10
to play-framework
OK, I have changed to session and solve the problem.

Thanks Guillaume Bort and Ivan Meredith


On 4月14日, 下午5時57分, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> Yes flash values are stored in cookies. But they are stored only for
> the next request. Maybe the cause of your problem.
>
> 2010/4/14 Ma Fai (gmail.com) <mafa...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages