final Charset c = getCharset(mediaType);
if (type.isAnnotationPresent(XmlRootElement.class)) {
if (u instanceof JSONUnmarshaller) {
JSONUnmarshaller ju = (JSONUnmarshaller)u;
ju.setJsonEnabled(true);
JAXBElement jaxbElem = (JAXBElement)ju.
unmarshal(new InputStreamReader(entityStream, c),
type);
return jaxbElem.getValue();
} else {
return u.unmarshal(