owlike / genson

Genson a fast & modular Java <> Json library
http://owlike.github.io/genson/
219 stars 65 forks source link

Disable GensonJaxRSFeature in resteasy web.xml #108

Open cengizkrbck opened 8 years ago

cengizkrbck commented 8 years ago

Hi,

In documentation/Extensions/JaxRs disabling genson explained. But it is for jersey. Is there any way to disable GensonJaxRSFeature in web.xml at resteasy application.

Our rest interface heavily depend on the Jackson, but also we need&like genson when class serialization & deserialization, so we can not remove it from dependencies.

resteasy selects a json-converter-provider from dependencies automatically.

Any help or pr really appreciated. @EugenCepoi

ps: i am also working with this but i am so newbie in resteasy&jaxrs stuff.

EugenCepoi commented 8 years ago

Are you doing this? If so in the application code you can implement getSingletons and return a set containing an instance of new GensonJaxRSFeature().disable(). Just like in the documentation.

If you have a question please first use the google group http://groups.google.com/group/genson or the gitter room https://gitter.im/owlike/genson.

cengizkrbck commented 8 years ago

Hi @EugenCepoi ,

Sorry for inconvenience about issue posting, but i think disabling support with web.xml may be good feature.

Then, I tried your suggestion; `public class MyApplication extends javax.ws.rs.core.Application{

@Override
public Set<Object> getSingletons()
{
    Set<Object> resources = new java.util.HashSet<>();
    resources.add(new GensonJaxRSFeature().disable());
    return resources;
}

}` and in web.xml

`init-param

        _param-name>javax.ws.rs.Application</param-name_

        _param-value>com.exchange.admin.web.services.application.MyApplication</param-value_

    _/init-param_`

It still uses genson to parse over jackson.

EugenCepoi commented 8 years ago

Np. Do you have a simplified version of your web.xml? Or even better would be a mavenized example that I can run to test it.

Sent from my iPhone

On Nov 18, 2016, at 12:13 AM, cengizkrbck notifications@github.com wrote:

Hi Eugen,

Sorry for inconvenience about issue posting, but i think disabling support with web.xml may be good feature.

Then, I tried your suggestion; `public class MyApplication extends javax.ws.rs.core.Application{

@Override public Set getSingletons() { Set resources = new java.util.HashSet<>(); resources.add(new GensonJaxRSFeature().disable()); return resources; } } and in web.xml

javax.ws.rs.Application com.exchange.admin.web.services.application.MyApplication `

It still uses genson to parse over jackson.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

cengizkrbck commented 8 years ago

Thanks @EugenCepoi , i am preparing an example code

btw, complete web.xml;

genson_web.txt

EugenCepoi commented 8 years ago

I don't see anything wrong in here, a runnable example would be helpful.