users@jersey.java.net

[Jersey] Re: hot class reloading

From: cowwoc <cowwoc_at_bbs.darktech.org>
Date: Thu, 20 Mar 2014 01:56:26 -0400

If you use Jetty, it'll hotswap static resources automatically.

Yes, you need to separate the static resources from the JAR file, and
place them ahead of your JARs on the classpath. Take a look at the
sample code I posted at
https://java.net/projects/jersey/lists/users/archive/2014-03/message/66

I hope this helps.

Gili

On 19/03/2014 9:59 PM, Oleksiy Stashok wrote:
> Adding Jersey mailing list in case anyone has experience with that.
>
> Just my guess is that you probably have to split resources jar out of
> main jar and replace and reload only resources, not entire jar.
>
> Thanks.
>
> WBR,
> Alexey.
>
> On 18.03.14 13:26, Andrew Munn wrote:
>> What is the best way to reload some part of the web facing portion of an
>> app running in production without taking the Grizzly/Jersey server down?
>>
>> I'm doing this:
>>
>> Set<Class<?>> classes = new HashSet<>();
>> classes.add(myapp.MyClass.class);
>> classes.add(myapp.MyOtherClass.class);
>> ResourceConfig rc = new ResourceConfig(classes);
>> HttpServer httpServer =
>> GrizzlyHttpServerFactory.createHttpServer(BASE_URI, rc);
>> System.out.println(String.format("Jersey app started with WADL available
>> at " + "%sapplication.wadl", BASE_URI, BASE_URI));
>>
>> and tried to reload like this after replacing the running jar:
>>
>> GrizzlyHttpContainer c =
>> (GrizzlyHttpContainer)httpServer.getHttpHandler();
>> c.reload();
>>
>> but no luck, just a ClassCastException. Will that method do what I want
>> and what's the preferred way to get a reference to it?
>>
>> Thanks!
>>
>>
>>
>