result = handler.getResult();
if (result instanceof JAXBElement<?>) {
result = ((JAXBElement<?>)result).getValue();
}
} catch (IllegalStateException e) {
throw new RestException("failed to unmarshal object", e);
} catch (JAXBException e) {
throw new RestException("failed to unmarshal object", e);
}
return result;
}