use of org.codehaus.jackson.JsonGenerationException in project appsly-android-rest by 47deg.
the class JacksonBodyConverter method toRequestBody.
@Override
public <T> HttpEntity toRequestBody(T object, String contentType) {
Logger.d("JacksonBodyConverter.toRequestBody: object: " + object);
try {
String json = mapper.writeValueAsString(object);
Logger.d("JacksonHttpFormValuesConverter.toRequestBody: json: " + json);
StringEntity result = new StringEntity(json, "UTF-8");
result.setContentType(contentType);
Logger.d("JacksonBodyConverter.toRequestBody: result: " + result);
return result;
} catch (UnsupportedEncodingException e) {
throw new SerializationException(e);
} catch (JsonMappingException e) {
throw new SerializationException(e);
} catch (JsonGenerationException e) {
throw new SerializationException(e);
} catch (IOException e) {
throw new SerializationException(e);
}
}
Aggregations