Annotation[] annotations,
MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream) throws IOException, WebApplicationException {
SyndEntry se = new SyndEntry();
Class<?> rawType = se.getClass();
Type genType = rawType;
String defaultErrorMessage = "An error has occurred while processing a request";
// Check if SyndEntry supports response MediaType
@SuppressWarnings("unchecked")
MessageBodyWriter<Object> messageBodyWriter =
(MessageBodyWriter<Object>)providers.getMessageBodyWriter(rawType,
genType,
null,
mediaType);
String localizedMessage = t.getLocalizedMessage();
localizedMessage = localizedMessage == null ? defaultErrorMessage : localizedMessage;
if (messageBodyWriter != null) {
se.setId(ID_PREFIX + UUID.randomUUID());
se.setUpdated(new Date(System.currentTimeMillis()));
se.setPublished(new Date(System.currentTimeMillis()));
se.setTitle(new SyndText(localizedMessage));
SyndContent syndContent = new SyndContent();
syndContent.setType(MediaType.TEXT_PLAIN);
syndContent.setValue(ExceptionHelper.stackTraceToString(t));
se.setContent(syndContent);
se.setSummary(new SyndText(localizedMessage));
messageBodyWriter.writeTo(se,
rawType,
genType,
null,
mediaType,