public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType m,
MultivaluedMap<String, String> headers, InputStream is)
throws IOException {
try {
Class<?> theType = getActualType(type, genericType);
Unmarshaller unmarshaller = createUnmarshaller(theType, genericType);
if (JAXBElement.class.isAssignableFrom(type)) {
return unmarshaller.unmarshal(new StreamSource(is), theType);
} else {
return unmarshaller.unmarshal(is);
}
} catch (JAXBException e) {
throw new WebApplicationException(e);
}