Share sessions

We have a website built with Java, and now I am going to add a sub
website with Rails. I am wondering how can I share sessions between
the main website and the sub website?

btw, the database of two websites may be different from each other.

Thank you!