users@jersey.java.net

[Jersey] Custom ObjectMapper for Jersey (1.18.1) with web-app 2.5

From: John Lee <john.lee_at_appdynamics.com>
Date: Wed, 27 Jan 2016 13:10:44 -0800

Hi All,

I've been struggling to plug in custom object mapper to jersey.
Any help will be greatly appreciated.

Here's my CustomObjectMapper class:
[image: Inline image 1]

I am plugging this into jersey using web.xml like so:
[image: Inline image 2]

This is not working and custom object mapper is not being used.
Is this the correct way to achieve this?

I've seen an example code written by Jakub Podlesak where he is using
a class extending Application and overriding getClasses. And adding custom
mapper to the class hashmap. Is that the way only to achieve this? Or can
it be done through web.xml?

Thanks!
-- 
*John K. Lee* | Software Engineer




Screen_Shot_2016-01-27_at_1.05.43_PM.png
(image/png attachment: Screen_Shot_2016-01-27_at_1.05.43_PM.png)

Screen_Shot_2016-01-27_at_1.01.47_PM.png
(image/png attachment: Screen_Shot_2016-01-27_at_1.01.47_PM.png)