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?