Using non-default JsonProvider

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using non-default JsonProvider

Svetlin Zarev
Hi,

If the application brings its own JsonProvider, then
JsonProvider.provider() should return it instead of the default one.
Instead TomEE always returns the default one (Johnzon). The issue is that
JsonProvider.doLoadProvider() returns the first encountered one and does
not check if it's the  default, which results in TomEE never loading the
application's JsonProvider


Do you think if this can be worked around ? I can provide PR for the
geronimo-json spec api, but I'm not sure if the project is active.

[1]
http://docs.oracle.com/javaee/7/api/javax/json/spi/JsonProvider.html#provider--

Kind regards,
Svetlin
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using non-default JsonProvider

Romain Manni-Bucau
Hi Svetlin,

we can add jsonp in
https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/util/classloader/URLClassLoaderFirst.java#L569
list to ensure the behavior you desire work (but note we respect the spec
in our current behavior). Can be workedaround with a custom classloader but
fixing this is probably saner.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-06-05 11:37 GMT+02:00 Svetlin Zarev <[hidden email]>:

> Hi,
>
> If the application brings its own JsonProvider, then
> JsonProvider.provider() should return it instead of the default one.
> Instead TomEE always returns the default one (Johnzon). The issue is that
> JsonProvider.doLoadProvider() returns the first encountered one and does
> not check if it's the  default, which results in TomEE never loading the
> application's JsonProvider
>
>
> Do you think if this can be worked around ? I can provide PR for the
> geronimo-json spec api, but I'm not sure if the project is active.
>
> [1]
> http://docs.oracle.com/javaee/7/api/javax/json/spi/
> JsonProvider.html#provider--
>
> Kind regards,
> Svetlin
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using non-default JsonProvider

Romain Manni-Bucau
PS: pushed it https://issues.apache.org/jira/browse/TOMEE-2052


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-06-05 11:39 GMT+02:00 Romain Manni-Bucau <[hidden email]>:

> Hi Svetlin,
>
> we can add jsonp in https://github.com/apache/tomee/blob/master/container/
> openejb-core/src/main/java/org/apache/openejb/util/classloader/
> URLClassLoaderFirst.java#L569 list to ensure the behavior you desire work
> (but note we respect the spec in our current behavior). Can be workedaround
> with a custom classloader but fixing this is probably saner.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2017-06-05 11:37 GMT+02:00 Svetlin Zarev <[hidden email]>
> :
>
>> Hi,
>>
>> If the application brings its own JsonProvider, then
>> JsonProvider.provider() should return it instead of the default one.
>> Instead TomEE always returns the default one (Johnzon). The issue is that
>> JsonProvider.doLoadProvider() returns the first encountered one and does
>> not check if it's the  default, which results in TomEE never loading the
>> application's JsonProvider
>>
>>
>> Do you think if this can be worked around ? I can provide PR for the
>> geronimo-json spec api, but I'm not sure if the project is active.
>>
>> [1]
>> http://docs.oracle.com/javaee/7/api/javax/json/spi/JsonProvi
>> der.html#provider--
>>
>> Kind regards,
>> Svetlin
>>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using non-default JsonProvider

Svetlin Zarev
In reply to this post by Romain Manni-Bucau
Hi,

I've tested it and it works like a charm ! may you add johnzon to the
filter list ?

Thanks and best regards,
Svetlin

2017-06-05 12:39 GMT+03:00 Romain Manni-Bucau <[hidden email]>:

> Hi Svetlin,
>
> we can add jsonp in
> https://github.com/apache/tomee/blob/master/container/
> openejb-core/src/main/java/org/apache/openejb/util/classloader/
> URLClassLoaderFirst.java#L569
> list to ensure the behavior you desire work (but note we respect the spec
> in our current behavior). Can be workedaround with a custom classloader but
> fixing this is probably saner.
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2017-06-05 11:37 GMT+02:00 Svetlin Zarev <[hidden email]
> >:
>
> > Hi,
> >
> > If the application brings its own JsonProvider, then
> > JsonProvider.provider() should return it instead of the default one.
> > Instead TomEE always returns the default one (Johnzon). The issue is that
> > JsonProvider.doLoadProvider() returns the first encountered one and does
> > not check if it's the  default, which results in TomEE never loading the
> > application's JsonProvider
> >
> >
> > Do you think if this can be worked around ? I can provide PR for the
> > geronimo-json spec api, but I'm not sure if the project is active.
> >
> > [1]
> > http://docs.oracle.com/javaee/7/api/javax/json/spi/
> > JsonProvider.html#provider--
> >
> > Kind regards,
> > Svetlin
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using non-default JsonProvider

Romain Manni-Bucau
should be done (think our messages were "concurrently sent" :))

PS: if you want to hit johnzon list as well to share why you needed to
switch it can allow to avoid this need (theorically you shouldnt be able to
switch impls in a EE server and if johnzon has a real gap we need to tackle
it)


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2017-06-05 12:37 GMT+02:00 Svetlin Zarev <[hidden email]>:

> Hi,
>
> I've tested it and it works like a charm ! may you add johnzon to the
> filter list ?
>
> Thanks and best regards,
> Svetlin
>
> 2017-06-05 12:39 GMT+03:00 Romain Manni-Bucau <[hidden email]>:
>
> > Hi Svetlin,
> >
> > we can add jsonp in
> > https://github.com/apache/tomee/blob/master/container/
> > openejb-core/src/main/java/org/apache/openejb/util/classloader/
> > URLClassLoaderFirst.java#L569
> > list to ensure the behavior you desire work (but note we respect the spec
> > in our current behavior). Can be workedaround with a custom classloader
> but
> > fixing this is probably saner.
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://blog-rmannibucau.rhcloud.com> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> > rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
> > 2017-06-05 11:37 GMT+02:00 Svetlin Zarev <svetlin.angelov.zarev@gmail.
> com
> > >:
> >
> > > Hi,
> > >
> > > If the application brings its own JsonProvider, then
> > > JsonProvider.provider() should return it instead of the default one.
> > > Instead TomEE always returns the default one (Johnzon). The issue is
> that
> > > JsonProvider.doLoadProvider() returns the first encountered one and
> does
> > > not check if it's the  default, which results in TomEE never loading
> the
> > > application's JsonProvider
> > >
> > >
> > > Do you think if this can be worked around ? I can provide PR for the
> > > geronimo-json spec api, but I'm not sure if the project is active.
> > >
> > > [1]
> > > http://docs.oracle.com/javaee/7/api/javax/json/spi/
> > > JsonProvider.html#provider--
> > >
> > > Kind regards,
> > > Svetlin
> > >
> >
>
Loading...