HttpServletRequest from ActionDispatch::Request

Hello,

I’m developing a Rails 3.1 application on JRuby 1.6.7 that interacts
with a
legacy Java-based application. Inside ApplicationController
:before_filter, I need to authenticate with the legacy codebase by
calling a method that requires an argument of type
javax.servlet.http.HttpServletRequest.

What’s the best way to create an HttpServletRequest from an
ActionDispatch::Request?

I spent some time searching online but nothing I’ve tried so far has
worked. I’ve tried passing the unmodified ActionDispatch::Request, as
well as request.to_java. I also tried
request.env[‘java.servlet_request’] (which doesn’t seem to exist
anymore?).

Any advice is appreciated - thanks in advance.