I've been working on wrapping a stateful CGI/Perl web application in a stateless, RESTful interface using JAX-RS 2. Besides the mechanics of interacting with the CGI/Perl web application (think judicious use of HTTP clients and HTML scraping), one challenging aspect has been ensuring that simultaneous requests to the REST service do not end up sharing a CGI/Perl application session.
Each request must establish and end a session for a particular webapp user; any incoming requests during that time should not establish a session with that same user.
My initial idea was to customize Tomcat's thread pool executor so that each thread was bound to a particular user. I made progess in this area, but abandoned the approach after struggles with the under-documented tomcat7-maven-plugin
. Besides, I was leery of being coupled to Tomcat at such a low level given how my custom org.apache.catalina.Executor
"borrowed" heavily from the [standar