} else {
type = MediaType.valueOf(contentType);
}
RuntimeContext runtimeContext = RuntimeContextTLS.getRuntimeContext();
Providers providers = runtimeContext.getProviders();
Class<? extends Object> cls = xmlWrapper.getValue().getClass();
// this code ignores possible generic types
// if in the future we would like to support the generic types
// should check here if cls is GenericEntity and handle it
MessageBodyWriter<Object> writer =
(MessageBodyWriter<Object>)providers.getMessageBodyWriter(cls, cls, null, type);
if (writer == null) {
logger.error(Messages.getMessage("noWriterFound", cls.getName(), type.toString())); //$NON-NLS-1$
throw new WebApplicationException(500);
}