[Jersey] Re: question about ResourceConfig

From: Richard Sand <>
Date: Tue, 30 Jul 2013 23:45:42 -0400

Hi Jakub - thanks for your reply. But what I'm asking about is how to pass
configuration parameters into my app. The links you provided are about
getting the app itself deployed, which I'm past. I'm asking about
deployment-specific configurations. I'm probably misunderstanding the
purpose of ResourceConfig...

Here's a simple example of what I'm doing with my regular servlets - I'm
asking what the proper technique is to do this with Jersey2, since it seems
to provide the proper mechanism. In my web.xml:


My servlet reads the param, gets the path to the conf file, and loads the
conf file, which has all of its environment-specific configuration

I want to use a similar approach with my Jersey2 application - when deployed
on a Jersey server, I have some mechanism via the deployment descriptor to
pass in initialization parameters, and when deployed using JerseyTest, I
have an alternate mechanism to pass in such parameters. My question is what
is the proper technique in Jersey2 to accomplish this?

Thanks for your help!

Best regards,



From: Jakub Podlesak []
Sent: Monday, July 29, 2013 7:20 AM
Subject: [Jersey] Re: question about ResourceConfig

Hi Richard,

I am not 100 % sure i understand your question. I am confused with 
the reference to Jersey 1. Anyway, to configure a specific ResourceConfig
in your web application, you may want to use the following servlet init
parameter in your web.xml descriptor: (see [1])
An example can be found at [2].
To achieve JAX-RS 2.0 portability, the referred application class
would directly extend the JAX-RS Application (as in [3]).

Please clarify if you asked for something else.




On Jul 26, 2013, at 8:07 PM, Richard Sand <> wrote:

Hey all - apologies for a newbie question - I'm using Jersey2 for the first
time (I've used Jersey1.17 before) and am writing an app to be deployed on
Tomcat7, and am trying to figure out how ResourceConfigs work. Typically to
make my web apps portable between environments, I'd have a context-param in
the web.xml holding the path to an external config file (which may be java
properties, an xml config file, or such). What's the proper pattern for
doing this technique in Jersey2?

Thanks for any input!