コード例 #1
0
 public void writeTo(
     JSONObject t,
     Class<?> type,
     Type genericType,
     Annotation annotations[],
     MediaType mediaType,
     MultivaluedMap<String, Object> httpHeaders,
     OutputStream entityStream)
     throws IOException {
   try {
     OutputStreamWriter writer = new OutputStreamWriter(entityStream, getCharset(mediaType));
     t.write(writer);
     writer.flush();
   } catch (JSONException je) {
     throw new WebApplicationException(
         new Exception(ImplMessages.ERROR_WRITING_JSON_OBJECT(), je), 500);
   }
 }