Greetings,
My controller is declared to return a POJO:
Sometimes clients need the POJOs, so they useCode:@RequestMapping("/btc") private ResponseEntity<BtcDto> touchClaims(BtcDto example) { return new ResponseEntity<BtcDto>(bankruptcyService.foo(example), HttpStatus.OK); }
which works as a charm. Next step it to makeCode:restTpl.postForEntity("http://localhost:9999/btc", ex, BtcDto.class, new HashMap<String, Object>()).getBody();
to return Json representation of the return object (some clients don't need POJOs, so I think Spring should be clever enough not to un-marshal Json payload back to POJO). Right now I'm getting Jackson framework exception "I/O error: Can not deserialize instance of java.lang.String out of START_OBJECT token"Code:restTpl.postForEntity("http://localhost:9999/btc", ex, String.class, new HashMap<String, Object>()).getBody();
I'd also like to add that the current working version of application leverages Jersey Web App, not Spring, and seems that Jersey makes both these scenarios work somehow. What I'm trying to do is to replace Jersey app with Spring and Jackson.
Any pointers on how to address this situation would be highly appreciated!
Alex


Reply With Quote