OK, I saw that the @Provider annotation is not yet supported: https://github.com/wso2/msf4j/issues/295
2017-07-19 16:48 GMT+02:00 Thomas LEGRAND <[email protected]>: > Hello, > > I would like to create a custom MessageBodyReader to parse custom > application/json content but it seems it is not registered at the startup > of msf4j. Here is my class: > > @Component > @Provider > @Consumes("application/json") > public class BundleMessageBodyReader implements MessageBodyReader<Bundle> { > > @Override > public boolean isReadable(Class<?> type, Type genericType, Annotation[] > annotations, MediaType mediaType) { > return type == Bundle.class; > } > > @Override > public Bundle readFrom(Class<Bundle> type, Type genericType, Annotation[] > annotations, MediaType mediaType, > MultivaluedMap<String, String> httpHeaders, InputStream entityStream) > throws IOException, WebApplicationException { > IParser parser = FhirUtil.CTX.newJsonParser(); > > Reader reader = new InputStreamReader(entityStream); > return parser.parseResource(Bundle.class, reader); > } > > } > > You can notice that I even added @Component annotation to test and when I > want to call my web service method which consume application/json and asks > for a Bundle as parameter, my debugger doesn't enter in the > MessageBodyReader. > > Here is my method: > > @POST > @Path("/set-stats") > @Produces(MediaType.APPLICATION_JSON) > @Consumes(MediaType.APPLICATION_JSON) > public String updateViewCounter(Bundle bundle) { > System.out.println("lala"); > return null; > } > > What am I missing? > > Regards, > > Thomas >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
