@SuppressWarnings("unchecked")
 @Override
 public void writeTo(
     T t,
     Class<?> type,
     Type genericType,
     Annotation[] annotations,
     MediaType mediaType,
     MultivaluedMap<String, Object> httpHeaders,
     OutputStream entityStream)
     throws IOException, WebApplicationException {
   // Add Cache-Control before start write body.
   httpHeaders.putSingle(HttpHeaders.CACHE_CONTROL, "public, no-cache, no-store, no-transform");
   if (t instanceof JsonSerializable) {
     try (Writer w = new OutputStreamWriter(entityStream, Charset.forName("UTF-8"))) {
       w.write(((JsonSerializable) t).toJson());
     }
   } else {
     delegate.writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream);
   }
 }