You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by David Leangen <os...@leangen.net> on 2016/08/19 05:36:14 UTC
[Converter] Use of Codec
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
Re: [Converter] Use of Codec
Posted by David Leangen <os...@leangen.net>.
Awesome, David B., thanks!
I tried it and it worked. I just had a problem with empty objects, so I patched the code up a bit. Will submit the patch later today.
Cheers,
=David
> On Aug 19, 2016, at 11:46 PM, David Bosschaert <da...@gmail.com> wrote:
>
> 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 <os...@leangen.net> 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
>>
>>
Re: [Converter] Use of Codec
Posted by David Bosschaert <da...@gmail.com>.
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 <os...@leangen.net> 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
>
>