users@jersey.java.net

[Jersey] Configuration to turn endpoints on/off

From: Richard Sand <rsand_at_idfconnect.com>
Date: Tue, 25 Apr 2017 14:33:36 +0000

Hi all - this may be a really basic question, but is there a way to use
runtime configuration (say, a properties file, or deployment descriptor)
so that some of the services in my Jersey2 server application can be
enabled or disabled by an administrator? Our app presently exposes 15 or
so different endpoints. It has 1 Application annotated with
@ApplicationPath with 3 classes annotated with @Path, and within those 3
classes about 15 or so different methods annotated with the usual
@Path/@<method>/_at_Produces.

My app has a few different techniques for reading its runtime
configuration, e.g. settings to connect to database resources etc. What
I want to do is add some configuration properties to the app so that
administrators can enable/disable the 3 classes or any of the individual
endpoints within those classes at the Jersey level. Could someone
suggest the best way to do this?

Taking that a step further, we want to control this configuration in
runtime, so if the configuration changes, we can update the jersey
configuration to enable/disable the changed services without having to
restart our container (which is Tomcat in this case).

Any advice appreciate! Thanks!

Best regards,

Richard