class JAXBElementEntityProvider implements EntityProvider<JAXBElement<?>> {

    @Override
    public JAXBElement<?> readFrom(Class<JAXBElement<?>> type,
                                   Type genericType,
                                   Annotation[] annotations,
                                   MediaType mediaType,
                                   MultivaluedMap<String, String> httpHeaders,
                                   InputStream entityStream) throws IOException {
        ParameterizedType parameterizedType = (ParameterizedType)genericType;
        Class<?> aClass = (Class<?>)parameterizedType.getActualTypeArguments()[0];
        try {
            JAXBContext jaxbContext = getJAXBContext(aClass, mediaType);
            return jaxbContext.createUnmarshaller().unmarshal(new StreamSource(entityStream), aClass);
        } catch (UnmarshalException e) {
            LOG.debug(e.getMessage(), e);
            return null;
        } catch (JAXBException e) {
            throw new IOException(String.format("Can't read from input stream, %s", e));
        }
    }

    public  JAXBElementEntityProvider(@Context Providers providers);

}