users@jersey.java.net

Re: [Jersey] How to react on URL "http:/localhost/" (root) ?

From: Martin Probst <mail_at_martin-probst.com>
Date: Mon, 7 Jul 2008 10:13:16 +0200

Hi,

> While this is easy with a standalone HTTP server, within GlassFish
> this is a problem: @Path("/") is not the root "http://localhost/" in
> GlassFish, but it is "http://localhost/MyWarFile/"! So my Resource
> cannot react.
>
> What can I do? I cannot change the client, so there must be anything
> in JaxRS / Servlet API / GlassFish that makes GlassFish return "200
> OK" when a client asks for "OPTIONS / ".

You can deploy your application as the root web application. You can
only do that for one webapp, but maybe it works for you ...

To do that, you have to deploy to the special name "ROOT.war" in the ~/
webapps/ directory of your application server. This "ROOT" web
application will then get requests to http://localhost/.

Regards,
Martin