Hi David, The Codecs are to be used as OSGi services, where you can look up the type via the mime-type. It's described in section 5.2 of RFC 215 :)
Having said that, this was not yet implemented in the Felix Converter, so I've added that just now [1]. The only thing is that there is no official mime type for yaml yet, so I just went with a few aliases that I think are commonly used. Basically the Felix converter bundle now provides these Codec services: g! inspect cap * 5 org.apache.felix.converter [5] provides: ---------------------------------------- ... service; org.osgi.service.converter.Codec with properties: osgi.codec.mimetype = application/json, application/x-javascript, text/javascript, text/x-javascript, text/x-json service.bundleid = 5 service.id = 20 service.scope = singleton service; org.osgi.service.converter.Codec with properties: osgi.codec.mimetype = text/yaml, text/x-yaml, application/yaml, application/x-yaml service.bundleid = 5 service.id = 21 service.scope = singleton Hope this works for you. Cheers, David [1] https://svn.apache.org/viewvc/felix/trunk/converter/src/main/java/org/apache/felix/converter/impl/Activator.java?r1=1756920&r2=1756919&pathrev=1756920 On 19 August 2016 at 06:36, David Leangen <[email protected]> wrote: > > Hi! > > I am probably missing something obvious, but how am I supposed to get a > reference to the Codec, and tell it that I want JSON? > > IIUC, this has not yet been implemented. Again, happy to help out if you > show me the way... > > Cheers, > =David > >
