Issue 10552

Guice webservice client modules should explicitly configure the gbif JacksonJsonProvider when building a jersey client

10552
Reporter: omeyn
Assignee: mdoering
Type: Bug
Summary: Guice webservice client modules should explicitly configure the gbif JacksonJsonProvider when building a jersey client
Priority: Major
Resolution: Fixed
Status: Closed
Created: 2011-12-23 14:35:46.156
Updated: 2013-12-06 13:15:59.88
Resolved: 2012-04-27 17:44:42.087
        
Description: Through a great deal of pain getting the registry index builder to work it became clear that the problem was that the RegistryClientModule's providesRegistryJerseyClient was not adding the jersey JacksonJsonProvider class to its config.  That is fixed now, but must also be done in any other *WsClientModules (ie checklistbank and occurrencestore).  The config should look something like this:

    ApacheHttpClient4Handler hch = new ApacheHttpClient4Handler(client, null, false);

    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getClasses().add(RegistryJacksonJsonProvider.class);
    // this line is critical!  Note that this is the jersey version of this class name!
    clientConfig.getClasses().add(JacksonJsonProvider.class);
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true);
    return new ApacheHttpClient4(hch, clientConfig);]]>
    


Author: mdoering@gbif.org
Comment: A new GbifWsClientModule was added to the common-ws project that all clients (clb,reg,occ) now subclass. It uses only private modules and accepts custom configs for the json polymorphic serialization. 
Created: 2012-04-27 17:44:42.113
Updated: 2012-04-27 17:44:42.113