Question

I have started using Clojure to build a web app (using ring and compojure) and everything is working fine with it.

However, when I use uberwar to create a war file and deploy it to Tomcat, my session is not visible to Tomcat.

The session mechanism itself is definitely working (it's preserving state for a shopping basket, for example) but there is no JSESSIONID and the Tomcat manager app, Java Melody, Psi Probe are all saying I have no sessions.

I'm sure there is something obvious I'm missing around creating the JSESSIONID, but I have not seen anything about this in any of the tutorials I have found.

Can someone point me towards an example of how a Clojure app deployed to a Tomcat server creates a JSESSIONID?

Thanks for any help

Was it helpful?

Solution

Ring uses its own session store.

However, if you are using a Servlet container, Ring will populate the request map with the various Servlet objects. In this case, the :servlet-request key refers to the HttpServletRequest object.

It's worth noting that Ring is an abstraction over HTTP, and doesn't necessarily rely on the Servlet specification. So as long as you use a Servlet container underneath, you should be able to use your Servlet sessions

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top