tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravi sankar <sankar_rav...@yahoo.co.in.INVALID>
Subject JsonbJaxrsProvider
Date Wed, 11 May 2016 15:12:00 GMT
Since the default org.apache.johnzon.jaxrs.jsonb.jaxrs.JsonbJaxrsProvider doesn't support application/*+json

I have created a simple provider extending JsonbJaxrsProvider

@Provider
@Produces({ "application/json", "application/*+json" })
@Consumes({ "application/json", "application/*+json" })
public class MyJsonbJaxRsProvider<T> extends JsonbJaxrsProvider<T> {
    @Override
    public boolean isWriteable(final Class<?> rawType, final Type genericType, final
Annotation[] annotations,
            final MediaType mediaType) {
        return super.isWriteable(rawType, genericType, annotations, mediaType)
                && !OutputStream.class.isAssignableFrom(rawType) &&
!StreamingOutput.class.isAssignableFrom(rawType)
                && !Writer.class.isAssignableFrom(rawType) &&
!Response.class.isAssignableFrom(rawType)
                && !JsonStructure.class.isAssignableFrom(rawType);
    }
}

Then added openejb-jar.xml in WEB-INF
<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.openejb.org/openejb-jar/1.1">
    <pojo-deployment  class-name="jaxrs-application">
        <properties>
            cxf.jaxrs.providers = com.example.MyJsonbJaxRsProvider
        </properties>
    </pojo-deployment>
</openejb-jar>

Application is working fine but 
I am seeing three MyJsonbJaxRsProvider registered in readers and writers, the default TomEEJohnzonProvider
is also resgistered
Am I doing something wrong 
I am using Tomee 7.0.0-M3 and Johnzon 0.9.3 
 
INFO - Using readers:
INFO -      org.apache.cxf.jaxrs.provider.PrimitiveTextProvider@1aae0dc
INFO -      org.apache.cxf.jaxrs.provider.FormEncodingProvider@17cf664
INFO -      org.apache.cxf.jaxrs.provider.MultipartProvider@1f91b
INFO -      org.apache.cxf.jaxrs.provider.SourceProvider@216e3d
INFO -      org.apache.cxf.jaxrs.provider.JAXBElementProvider@a7c9e5
INFO -      com.example.MyJsonbJaxRsProvider@3ede03
INFO -      com.example.MyJsonbJaxRsProvider@1c432be
INFO -      com.example.MyJsonbJaxRsProvider@c7e6fd
INFO -      org.apache.openejb.server.cxf.rs.CxfRSService$TomEEJohnzonProvider@11929da
INFO -      org.apache.openejb.server.cxf.rs.CxfRSService$TomEEJsonpProvider@17dab5b
INFO -      org.apache.cxf.jaxrs.provider.StringTextProvider@63e761
INFO -      org.apache.cxf.jaxrs.provider.BinaryDataProvider@7feea8
INFO -      org.apache.cxf.jaxrs.provider.DataSourceProvider@18669b
INFO - Using writers:
INFO -      org.apache.johnzon.jaxrs.WadlDocumentMessageBodyWriter@19385eb
INFO -      org.apache.cxf.jaxrs.provider.StringTextProvider@63e761
INFO -      org.apache.cxf.jaxrs.provider.PrimitiveTextProvider@1aae0dc
INFO -      org.apache.cxf.jaxrs.provider.FormEncodingProvider@17cf664
INFO -      org.apache.cxf.jaxrs.provider.MultipartProvider@1f91b
INFO -      org.apache.cxf.jaxrs.provider.SourceProvider@216e3d
INFO -      org.apache.cxf.jaxrs.provider.JAXBElementProvider@a7c9e5
INFO -      com.example.MyJsonbJaxRsProvider@3ede03
INFO -      com.example.MyJsonbJaxRsProvider@1c432be
INFO -      com.example.MyJsonbJaxRsProvider@c7e6fd
INFO -      org.apache.openejb.server.cxf.rs.CxfRSService$TomEEJohnzonProvider@11929da
INFO -      org.apache.openejb.server.cxf.rs.CxfRSService$TomEEJsonpProvider@17dab5b
INFO -      org.apache.cxf.jaxrs.provider.BinaryDataProvider@7feea8
INFO -      org.apache.cxf.jaxrs.provider.DataSourceProvider@18669b
INFO - Using exception mappers:
INFO -      org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper@dc2097
INFO -      org.apache.openejb.server.cxf.rs.EJBExceptionMapper@1f3948a
INFO -      org.apache.cxf.jaxrs.validation.ValidationExceptionMapper@f01211

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message