|
|
@ -55,17 +55,11 @@ public class FaultMessageBodyWriter implements MessageBodyWriter<FaultResponse>
|
|
|
|
public void writeTo(FaultResponse faultResponse, Class<?> aClass, Type type, Annotation[] annotations,
|
|
|
|
public void writeTo(FaultResponse faultResponse, Class<?> aClass, Type type, Annotation[] annotations,
|
|
|
|
MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap,
|
|
|
|
MediaType mediaType, MultivaluedMap<String, Object> stringObjectMultivaluedMap,
|
|
|
|
OutputStream outputStream) throws IOException, WebApplicationException {
|
|
|
|
OutputStream outputStream) throws IOException, WebApplicationException {
|
|
|
|
OutputStreamWriter writer = null;
|
|
|
|
try (OutputStreamWriter writer = new OutputStreamWriter(outputStream, UTF_8)) {
|
|
|
|
try {
|
|
|
|
|
|
|
|
writer = new OutputStreamWriter(outputStream, UTF_8);
|
|
|
|
|
|
|
|
JsonObject response = new JsonObject();
|
|
|
|
JsonObject response = new JsonObject();
|
|
|
|
response.addProperty("error", faultResponse.getCode().getValue());
|
|
|
|
response.addProperty("error", faultResponse.getCode().getValue());
|
|
|
|
response.addProperty("error_description", faultResponse.getDescription());
|
|
|
|
response.addProperty("error_description", faultResponse.getDescription());
|
|
|
|
getGson().toJson(response, type, writer);
|
|
|
|
getGson().toJson(response, type, writer);
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
if (writer != null) {
|
|
|
|
|
|
|
|
writer.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|