aspose file tools*
The moose likes JSF and the fly likes JSF 2 Flash scope cookie not set Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF 2 Flash scope cookie not set" Watch "JSF 2 Flash scope cookie not set" New topic
Author

JSF 2 Flash scope cookie not set

Hany Shafik
Ranch Hand

Joined: Jun 21, 2008
Posts: 80
Hi All,

I tired flash scope in JSF 2 (mojarra project) and I found it not working when redirecting to a page in a different path other than source page.
For example you can see from the http requests below that the cookie isn't resent, this is because the path of the cookie hasn't been set to the root.

POST /Test/admin/editUser.jsf HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-us
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; GTB6.6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
Host: localhost:8280
Content-Length: 150
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: csfcfc=4Xfn_5Xfn; JSESSIONID=0CF90B01B8329B0174BA4B40C2D5C275



HTTP/1.1 302 Moved Temporarily
Server: Apache-Coyote/1.1
X-Powered-By: JSF/2.0
Set-Cookie: csfcfc=_8Xfr
Location: http://localhost:8280/Test/success.jsf
Content-Length: 0
Date: Mon, 29 Nov 2010 12:35:15 GMT

GET /Test/success.jsf HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; GTB6.6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
Host: localhost:8280
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=0CF90B01B8329B0174BA4B40C2D5C275


I did some debugging and I found the following in method encode in class com.sun.faces.context.flash.ELFlash.PreviousNextFlashInfoManager that is responsible for creating this cookie. it is seems that when the length of value of the cookie is not equal to 1 character then don't set the path of the cookie to the root.

I don't understand what was the intention for doing so? it causes problems when redirecting to a page in a different path, is it a bug?





 
Consider Paul's rocket mass heater.
 
subject: JSF 2 Flash scope cookie not set
 
Similar Threads
Cookies not getting stored in IE6 and IE7 when running in environment resembling production
Identical request in browser and Java with different responses, why does this happen?
Create post request with apache HttpClient
How to delete a cookie from Request (age old question never answered)
[WAS 7] java.io.IOException when file uploading with IE 8, works on FireFox 6