users@jersey.java.net

[Jersey] Migrating from Jersey Test Framework 1.x to 2.x

From: Markus Karg <karg_at_quipsy.de>
Date: Wed, 10 Sep 2014 17:04:30 +0200

I am currently migrating some rather old source code from Jersey Test Framework 1.x to 2.x and found some issue I couldn't solve using the published docs, so I hope that the Jersey team reads this posting and can provide a short answer. :)


(1) The old code is using JerseyTest.resource() to get a client that is preconfigured to the path of the application (not a single resource!) provided in the constructor. There is no more resource() method now, so can I rely upon JerseyTest.client() to be preconfigured to the root URL of the application, or how to get that root URL in the 2.x test framework?

(2) The old code is using URLConnectionClientHandler.PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND = Boolean.TRUE to enable the tweaks I contributed to Jersey some years ago. As URLConnectionClientHandler is gone in 2.x framework, how to enable the tweaks now?



Thanks a lot!

-Markus