users@grizzly.java.net

Re: [Jersey] Adding additional configuration to grizzly

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 04 Dec 2009 11:38:31 +0100

On Dec 4, 2009, at 11:31 AM, Oleksiy Stashok wrote:

> Hi,
>
> just to make sure, the problem is that Grizzly doesn't see the
> provided xml file, or some exception occurs, or...?
>

I think Ben wants to configure Grizzly such that static files if
present are served by Grizzly and take priority over any registered
Adapter that would otherwise serve the URL.

So if there is a file "xyz.xml" present in some directory and one
configures Grizzly to serve static from that directory is it possible
configure the Jersey adapter to be hosted at the "/' path as well as
static files be served by Grizzly. Such that say if the URL is http://localhost:9988/xyz.xml
  then the static file xyz.xml is returned otherwise say if the URL is http://localhost:9988/foobar
  the URL is served by Jersey, where foobar matches a resource class
such as:

   @Path("foobar") public class FooBar { ... }

Paul.


> Thanks.
>
> WBR,
> Alexey.
>
>
> On Dec 4, 2009, at 10:28 , Paul Sandoz wrote:
>
>> Hi,
>>
>> Cross posting to the grizzly users list.
>>
>> Paul.
>>
>> Begin forwarded message:
>>
>>> From: lisha jermanias <hilizbabe_at_yahoo.com>
>>> Date: December 3, 2009 7:35:53 PM CEST
>>> To: users_at_jersey.dev.java.net
>>> Subject: [Jersey] Adding additional configuration to grizzly
>>> Reply-To: users_at_jersey.dev.java.net
>>>
>>>
>>> Hello,
>>>
>>> My jersey with grizzly is setup using below code and it works
>>> great. Now I need to serve a static xml (which is not part of
>>> grizzly) in the root of the server.
>>>
>>> http://localhost:9988/xyz.xml
>>>
>>> How do I configure grizzly in the below code to add this xml?
>>>
>>> Map<String, String> initParams = new HashMap<String,
>>> String>();
>>> initParams.put("com.sun.jersey.config.property.packages",
>>> "com.xxx");
>>>
>>> ResourceConfig config = new ResourceConfig(initParams,
>>> store);
>>> RuntimeDelegate rd = RuntimeDelegate.getInstance();
>>> Adapter a = rd.createEndpoint(config, Adapter.class);
>>>
>>> logger.info("Starting grizzly...");
>>> try
>>> {
>>> //TODO read url from config
>>> URI BASE_URI =
>>> UriBuilder.fromUri("http://localhost/").port(9998).build();
>>> threadSelector = GrizzlyServerFactory.create(BASE_URI,
>>> a);
>>> logger.info("Grizzly Started. WADL: " + BASE_URI +
>>> "application.wadl");
>>> }
>>> catch(IOException ex)
>>> {
>>> logger.info("Error while starting grizzly...", ex);
>>> }
>>>
>>> Thanks
>>> Ben
>>>
>>
>