-
[프로그래밍] Json response in spring mvc 3.02011.10.28 AM 09:20
YourRespone is Java object to be returned to a requeter.
Using MappingJacksonHttpMessageConverter required code.haus.jackson library
YourResponse yourRespone = new YourRespone(param);
MappingJacksonHttpMessageConverter jsonConverter = new MappingJacksonHttpMessageConverter();
MediaType jsonMimeType = MediaType.APPLICATION_JSON;
if (jsonConverter.canWrite(accountResponse.getClass(), jsonMimeType)) {
try {
jsonConverter.write(accountResponse, jsonMimeType, new ServletServerHttpResponse(response));
} catch (IOException m_Ioe) {
// TODO: announce this exception somehow
} catch (HttpMessageNotWritableException p_Nwe) {
// TODO: announce this exception somehow
}
댓글 : 0 개
user error : Error. B.