Reputation: 797
I am upgrading from from v0.7.1 to v0.8 and have found that the Jersey filter functionality that we are using has been deprecated. The following line:
environment.jersey().getResourceConfig().getContainerRequestFilters().add(new FilterAuthentication());
(pretty much identical to the DW manual )
now gives a compiler error:
"The method
getContainerRequestFilters()is undefined for the Type
ResourceConfig"
Please can someone point me in the right direction on how to upgrade this feature. Many thanks
Upvotes: 3
Views: 809
Reputation: 209052
Dropwizard 0.8.x uses Jersey 2.x. Most of the methods in ResourceConfig
changed. For Jersey 2, you can use the general purpose register
method, used to bind any JAX-RS component.
Dropwizard also has a register
method chained to jersey()
, so there we don't have to call getResourceConfig()
, as jersey().register()
will forward to the config's register
method.
So either of these will work
env.jersey().register(...);
env.jersey().getResourceConfig().register(...);
Also see the Jersey 2 ResourceConfig API
Upvotes: 3