p:log and cookie value

UI Components for JSF
Post Reply
holek
Posts: 31
Joined: 18 Oct 2011, 16:23

07 Dec 2011, 21:14

Hi,

when i use p:log on a page then tomcat shows invalid cookie message every request:

2011-12-07 20:03:17 org.apache.tomcat.util.http.Cookies processCookieHeader
INFO: Cookies: Invalid cookie. Value not a token or quoted value
I think this cookie problematic:
name: blackbird
value: {pos:0,size:0,load:true}

is it a bug?

Tomcat 7.0.23, Primefaces 3.0M4

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

08 Dec 2011, 04:24

Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

holek
Posts: 31
Joined: 18 Oct 2011, 16:23

08 Dec 2011, 10:54

Thank you for your answer :)

Finally, I have changed log.js file from svn trunk to quote blackbird cookie value

here is a patch ( could this be changed in trunk too ? ) :

Code: Select all

@@ -8,7 +8,7 @@
 	The MIT License - Copyright (c) 2008 Blackbird Project
 */
 if ( ! document.cookie.match( /blackbird=/ ) ) {
-    document.cookie = 'blackbird={pos:0,size:0,load:true};';
+    document.cookie = 'blackbird="{pos:0,size:0,load:true}";';
 }
     
 ( function() {
@@ -226,7 +226,7 @@
 		
 		var expiration = new Date();
 		expiration.setDate( expiration.getDate() + 14 );
-		document.cookie = [ 'blackbird={', props, '}; expires=', expiration.toUTCString() ,';' ].join( '' );
+		document.cookie = [ 'blackbird="{', props, '}"; expires=', expiration.toUTCString() ,';' ].join( '' );
 
 		var newClass = [];
 		for ( word in classes ) {
@@ -236,7 +236,7 @@
 	}
 	
 	function getState() {
-		var re = new RegExp( /blackbird=({[^;]+})(;|\b|$)/ );
+		var re = new RegExp( /blackbird="({[^;]+})"(;|\b|$)/ );
 		var match = re.exec( document.cookie );
 		return ( match && match[ 1 ] ) ? eval( '(' + match[ 1 ] + ')' ) : { pos:null, size:null, load:null };
 	}

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

08 Dec 2011, 14:47

You're welcome, and thanks for your response, which includes a solution to your issue! Others may be able to benefit from your solution! :)
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

08 Dec 2011, 15:10

What about creating an issue and append the patch?
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko


smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

08 Dec 2011, 15:51

Great idea!
zoigl wrote:What about creating an issue and append the patch?
Good work! Thanks.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

09 Dec 2011, 11:56

Log component is reimplemented as a native PF widget instead of using blackbird so this is not valid anymore.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 42 guests