[jax-rs-spec users] How to use JAX-RS on the root context (as an application wide MVC like request router / dispatcher)

From: Eran Medan <>
Date: Wed, 12 Jun 2013 17:32:27 -0400

Dear Fellow JAX-RS users!

I'm trying to use JAX-RS as an MVC router, (to replace the need for
Spring's @RequestMapping)

To do so, I would like to have my JAX-RX Application start at the root
context, so my URLs will be*/*restfullPath <>

and not:*/rest*/restfullPath<>

I switched my Application's annotation from this


to this


All works well, but then it seems that it takes over serving files such as
/index.html or /index.jsp

Is there a way to run a JAX-RS on the root context but still have static /
JSP pages served?

Seems this was asked before <> on
the JBOSS forum, but the solution is not really practical

(I asked this originally here:
the answer is too cumbersome and negates the benefit of using JAX-RS with
it's simplicity and elegant API)

The reason I'm asking is that this moved me back to Spring, which I rather
work without
In Spring @RequestMapping("/foo") works as well as
@RequestMapping("/foo/bar") and is absolute to the web app context, and can
serve JSP / HTML views without a problem.

In other words, I would expect to be able to map any request in JEE to any
resource, whether it's a JSON service, or a JSP view using the same easy to
use @Path annotation, can it be done?