Specifying a URI prefix for a route


I have an unusual requirement. I have two apps. deployed in a JEE
container (one Rails, one Merb), and I am redirecting various requests
between them. That is, from app. A, I am redirecting to a app. B URL
and vice versa.

Because these are JEE apps., I have to specify a "servlet context" which
is basically a prefix to keep the docroots of various Web apps.
distinct. For example, the first app. might be deployed under app_one,
so an example URL would look like:


In this example, the doc root is /app_one/

I would like to use routes to generate my "cross-app" URLs, but what I
am running into is that because the URLs from the routes are being
generated relative to the current document root, I am having to remove
the current application's document root from the URL using gsub to get
the links to work.

Is a parameter than can be used in the routes.rb file (and router.rb in
the Merb world, if you know) to specify that the generated URI should be
absolute and not relative to the current docroot?


if u are using mongrel, you can add the global prefix like this:
mongrel_rails start --prefix /myapp
the Path following --prefix must begin with /

However, i make no senss of deploying app in jee.