Its been a long time since my last full blog post here which happened to also be my first ever. All kinds of things have changed since then. I’ve been all around the Java world and back again. Tried Grails, left it, worked with a number of other Java frameworks, picked up Python and have ended up back on Grails once again. I’ve started post after post to try and cover the journey almost all for different reasons along the way. But today I just had to pause and really question why I’ve run into so many “gotchas” in Java land.
To explain where I am now, I’m working on BugginMe a new social sharing site built on Grails. Just prior to that I was a part of another social networking startup building on GWT at one time backed by a Python server and then Groovy. Before that I was on my worldwind tour of the Java world looking for my stack of choice but hitting pitfalls and gotchas everywhere. The gotchas I’m discussing are roadblocks that popped up for me and made me ask how anyone could be using this platform. For instance I was falling in love with JSF 2 and building an app and then I was blindsided with the fact that I can’t simply build a paging mechanism. Well that was made ok when I discovered I was supposed to be using component libraries until I ran into gotchas such as a library not having a particular component or one that does but then doesn’t work with something else in the stack.
Well today I don’t know if it was one too many or just the most “interesting” gotcha or just that I couldn’t believe I’d never noticed it. But it really just caused me to stop work. This gotcha is the fact that Java session cookies (at least for Tomcat) are truly session cookies and are lost on browser restart. That in itself isn’t bad at all but when I went to find the correct way to change this and discover hacks or the need for filters or even the suggestion that Tomcat code would need to be changed my jaw dropped. There was also the suggestion that a custom cookie be used for session tracking but we’ve built around standard sessions through Grails including a SessionManager to move the session data to a central database so I wasn’t going to change it.
As I’ve mentioned in my other blog post I’ve worked with PHP, ASP, ASP.Net and other environments and I can’t recall having this pop up. The cookies have expiration dates. If I set the session timeout then it survives the browser restart. I’m certain there’s probably an enterprise Java explanation for this behavior and I solved it by implementing a separate “remember me” cookie setup which I was going to do anyway. But there just always seems to be these gotchas that pop up when developing an average app that’s not a big enterprise system. I guess this would explain the movement I’ve been seeing lately to use Java (and Groovy and Scala) in a manner similar to what I see in the Python world. After working with Python for a year I started to have the same feelings myself. So despite the gotchas I feel its an exciting time to be using Java for all kinds of projects. You just have to watch where you’re walking.