I love open source projects (Sakai guy here) and this ended up being pretty
simple code. I've created a GitHub project to share the code:
https://github.com/baholladay/WicketRedisSession

It essentially is a passthrough to storing data on Redis. It relies on the
Jedis library (dependency below) and you simply add the following lines to
your Application#init method:

setSessionStoreProvider(new RedisSessionStoreProvider());
setPageManagerProvider(new RedisPageManagerProvider(this));

pom.xml:
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.6.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

I've tested this with ElasticLoadBalancer set to non-sticky sessions and
Redis on 3 AWS tomcat nodes and it worked perfectly. Every request went to
a different server and never had any issues. I use a lot of ajax components
and have several nested pages and workflows too. Right now I consider this
still a proof of concept because I had to rely on the IP address as the
session ID. I prefer to use JSESSIONID and will look into fixing this
(please make a pull request if you have a solution). I think this has to do
with the fact that I do not rely on cookies in any situation since IE and
Safari doesn' play nicely with IFrames and cross domains. I've have
"getResourceSettings().setEncodeJSessionId(true);" set, it's not that.

Thanks,
Bryan

On Tue, Feb 10, 2015 at 4:00 AM, Martijn Dashorst <
martijn.dasho...@gmail.com> wrote:

> I'm looking forward to hear more about this setup. It was my
> understanding that Wicket can't run in a non-sticky cluster setup due
> to the required pagemap locks to avoid concurrent updates to the
> component hierarchy. But I'd be very happy to hear my understanding
> being disproved.
>
> Martijn
>
>
>
> On Tue, Feb 10, 2015 at 2:51 AM, Bryan Holladay <holla...@longsight.com>
> wrote:
> > Thank you Martin! I was able to get it to work really simply with setting
> > the following in my WebApplication:
> >
> > setSessionStoreProvider
> > setPageManagerProvider
> >
> > The implementations just passively passed and retrieved the data to and
> > from my Redis server.
> >
> > Thanks,
> > Bryan
> >
> >
> >
> > On Mon, Feb 9, 2015 at 3:32 PM, Martin Grigorov <mgrigo...@apache.org>
> > wrote:
> >
> >> Hi,
> >>
> >> Since I while I want to create an integration with
> >> https://github.com/spring-projects/spring-session but I haven't had the
> >> time (and demand).
> >> The way to do it is to create custom impl of ISessionStore interface.
> >>
> >> Otherwise I remember a user in the community successfully using
> distributed
> >> sessions with Jetty's JDBC session manager (
> >>
> >>
> http://www.eclipse.org/jetty/documentation/current/session-clustering-jdbc.html
> >> ).
> >>
> >> Martin Grigorov
> >> Wicket Training and Consulting
> >> https://twitter.com/mtgrigorov
> >>
> >> On Mon, Feb 9, 2015 at 7:51 PM, Bryan Holladay <holla...@longsight.com>
> >> wrote:
> >>
> >> > Has anyone setup wicket's AuthenticatedWebApplication sessions to use
> a
> >> > distributed memory cache (e.g. memcached, redis)? I would like to make
> >> the
> >> > sticky sessions fail over to other tomcat's and allow non sticky load
> >> > balancers.
> >> >
> >> > For example, I tested with
> >> > https://github.com/magro/memcached-session-manager on tomcat 7 with
> >> > memcached and both ELB and NGINX and it seems to not work with
> Wicket. I
> >> > also tested with redis by implementing
> >> > AuthenticatedWebApplication#fetchCreateAndSetSession.
> >> >
> >> > Thanks,
> >> > Bryan
> >> >
> >>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>

Reply via email to