public void writeTo(Categories categories, Class<?> type, Type genericType,
Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> headers,
OutputStream stream) throws IOException, WebApplicationException {
if (mediaType.equals(MediaType.APPLICATION_JSON_TYPE) || mediaType.getSubtype().endsWith("+json")) {
Writer writer = Abdera.getInstance().getWriterFactory().getWriter("json");
writer.writeTo(categories, stream);
} else {
categories.writeTo(stream);
}
}