grails-cookie-session icon indicating copy to clipboard operation
grails-cookie-session copied to clipboard

Cannot use 'grails.plugin.cookiesession.serializer'

Open fchristol opened this issue 7 years ago • 1 comments

Hello,

I have created a custom Session serializer which implements SessionSerializer and that is declared as bean mySessionSerializer. But I cannot use it with : grails.plugin.cookiesession.serializer='mySessionSerializer'

The reason is that it seems that there is a bug in CookieSessionRepository.groovy, in line :

else if( applicationContext.containsBean(serializer) && applicationContext.getType(serializer) instanceof SessionSerializer ){

Indeed, the test "applicationContext.getType(serializer) instanceof SessionSerializer" is never 'true'. It is even not 'true' for the 'javaSessionSerializer' :

"applicationContext.getType('javaSessionSerializer') instanceof SessionSerializer" is 'false'

My two cents is that the test should be :

"applicationContext.getBean(serializer) instanceof SessionSerializer", which returns 'true' as expected

fchristol avatar Nov 29 '17 10:11 fchristol

If you are using Grails 3, please try http://plugins.grails.org/plugin/double16/cookie-session . This issue has been addressed there.

double16 avatar Jan 09 '18 17:01 double16