Advertisement
dmfrey

Untitled

Sep 11th, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. @RequestMapping(value = "/contents", produces="application/json")
  2. public @ResponseBody List<ContentVO> compare(@RequestParam("component") long componentId, Model model) throws ServiceException {
  3.     List<Map<String, Object>> rawData = contentService.getContent(componentId);
  4.     // throw some logging here
  5.     List<ContentVO> list;
  6.     try {
  7.         list = ReflectionUtils.convert(rawData, ContentVO.class);
  8.         // and throw some logging here
  9.         return list;
  10.        
  11.     } catch (InstantiationException | IllegalAccessException e) {
  12.         throw new ServiceException(e);
  13.     }
  14.  
  15. @ExceptionHandler( ServiceException.class )
  16. public String handleServiceException( ServiceException e ) {
  17.     return e.getMessage();
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement