users@jersey.java.net

Re: [Jersey] Setting properties for ResourceConfig

From: Harald Kirsch <pifpafpuf_at_gmx.de>
Date: Sun, 27 Jul 2008 11:54:48 +0200

Hi,

some source code inspection helped to find this:-)

Am 27.07.2008 11:19 schrieb Harald Kirsch:
> Hi,
>
> my application is started with
>
> HttpServer server =
> HttpServerFactory.create("http://localhost:"+port+'/');
> server.start();
>
> and works just fine. But it scans each and every entry of the classpath
> for resources. It does not really hurt, but it also is not nice, in
> particular since there are configuration options to tell explicitly
> where to search.

Now I use this:

    Map<String, Object> props = new HashMap<String, Object>();
    props.put(ClasspathResourceConfig.PROPERTY_CLASSPATH,
              getFirst(cmdArgs, "resources", "lib/cycleroute.jar"));
    ResourceConfig rcf = new ClasspathResourceConfig(props);

    HttpHandler handler =
ContainerFactory.createContainer(HttpHandler.class,
                                                           rcf);
    HttpServer server =
      HttpServerFactory.create("http://localhost:"+port+'/', handler);

And startup is muuuuuuch faster now:-)

Thanks anyway,
Harald.

-- 
--------------+---------------------------------------------
Harald Kirsch | pifpafpuf bei gmx punkt de