use of org.springframework.web.servlet.view.json.MappingJackson2JsonView in project spring-framework by spring-projects.
the class ViewResolverRegistryTests method contentNegotiation.
@Test
public void contentNegotiation() {
MappingJackson2JsonView view = new MappingJackson2JsonView();
this.registry.enableContentNegotiation(view);
ContentNegotiatingViewResolver resolver = checkAndGetResolver(ContentNegotiatingViewResolver.class);
assertThat(resolver.getDefaultViews()).isEqualTo(Arrays.asList(view));
assertThat(this.registry.getOrder()).isEqualTo(Ordered.HIGHEST_PRECEDENCE);
}
use of org.springframework.web.servlet.view.json.MappingJackson2JsonView in project disconf by knightliao.
the class JsonObjectUtils method JsonObjectError2ModelView.
/**
*/
public static ModelAndView JsonObjectError2ModelView(JsonObjectError json) {
ModelAndView model = new ModelAndView(new MappingJackson2JsonView());
model.addObject(FrontEndInterfaceConstant.RETURN_SUCCESS, json.getSuccess());
model.addObject(FrontEndInterfaceConstant.RETURN_MESSAGE, json.getMessage());
model.addObject(FrontEndInterfaceConstant.STATUS_CODE_STRING, json.getStatus());
model.addObject(FrontEndInterfaceConstant.SESSION_ID, json.getSessionId());
return model;
}
Aggregations