Hello Jakub,
I removed @Produces annotation for my ContextResolver implementation. I
also turned on POJOMappingFeature feature. But it didn't work. Then I
checked code from sample link you sent. It worked well. The difference was
that my application is deployed to glassfish 3.0.1 and sample code starts
their own Grizzly container. So I tried to deploy sample code to glassfish
and found that it didn't work. The problem was related to old Jersey
libraries inside glassfish. It looks like glassfish 3.0.1 contains old
Jersey (1.1.5) version. I used
http://jersey.java.net/nonav/documentation/latest/glassfish.htmlinstruction
to update Jersey libraries to last. It helped.
(Note that instruction is not correct about glassfish/modules/mimepull.jar;
when I remove it the glassfish will not work. So need to keep this jar.)
As result the application started to use my ObjectMapper instance, but I
met another problem. It looks like enabled POJOMappingFeature flag disables
JAXB parsing so that all my POST requests that contain JSON parameters fall
down. It couldn't parse request. I think it happens because of I used JAXB
and all POJO classes has only JAXB annotations. Also REST service responses
had wrong format, for example, for field name. Format is specified using
JAXB annotation also.
After several attempts to fix it I didn't get what I wanted then I released
small hack to return date format what I exactly need as returned value.
Thanks to everybody for replies!
Vasiliy