users@jersey.java.net

[Jersey] Re: Custom ParamConverterProvider

From: Miles, Eric (CONT) <"Miles,>
Date: Thu, 31 Oct 2013 11:23:35 -0400

I solved my problem, but I think it's most likely a defect in HK2. I had to manually add a qualifier via the HK2 API for this converter. The binding before:

bind(NonPublicInformationParamConverterProvider.class).to(ParamConverterProvider.class).in(Singleton.class);


Binding after:

            bind(NonPublicInformationParamConverterProvider.class).to(ParamConverterProvider.class).in(Singleton.class).qualifiedBy(new CustomAnnotationImpl());


I really don't think I should need to manually specify the qualifier when my class is annotated with @Custom. HK2 should take care of that under the covers. Any of the Jersey devs can comment on this and confirm it's an issue with HK2? If so, I'll open a defect with that team.


Thanks,
Eric Miles


From: Ivar <ivarconr_at_gmail.com<mailto:ivarconr_at_gmail.com>>
Reply-To: Jersey Users <users_at_jersey.java.net<mailto:users_at_jersey.java.net>>
Date: Thursday, October 31, 2013 10:49 AM
To: Jersey Users <users_at_jersey.java.net<mailto:users_at_jersey.java.net>>
Subject: [Jersey] Re: Custom ParamConverterProvider


Silly guess, have you tried the @Provider annotation? That is what I use to register custom providers.

Ivar

On 31 Oct 2013 15:42, "Miles, Eric (CONT)" <Eric.Miles_at_capitalone.com<mailto:Eric.Miles_at_capitalone.com>> wrote:
All,

I have created a custom ParamConverterProvider and have annotated it with the @Custom qualifier, which is supposed to be looked at first for parameter conversion. However, when I debug the ParamConverterFactory, I can see my converter is not found with the Providers.getCustomProviders() call, however it returns in the Providers.getProviders() call and is AFTER the default AggregatedProvider…which means my converter is never called at all. Here is my converter definition:


@Custom

@Singleton

public class NonPublicInformationParamConverterProvider implements ParamConverterProvider {

Is this all that needs to be done to identify it's a custom Provider?? When I debug and get down into the weeds of HK2, I can see the SystemDescriptor that wraps this provider identifies that there are no qualifiers for the class.

Eric Miles
Senior Manager/ Architect | CapTech
Platform Engineering | Team Super Glue (Mobile)
cell: (804) 322-9253<tel:%28804%29%20322-9253> | eric.miles_at_capitalone.com<mailto:eric.miles_at_capitalone.com>

________________________________

The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
________________________________________________________

The information contained in this e-mail is confidential and/or proprietary to Capital One and/or its affiliates. The information transmitted herewith is intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.