0
所以我有了这个控制器方法,这显然是返回ResponseEntity:Java - RestTemplate语法错误?
@RequestMapping(method=RequestMethod.POST, value="sendEmail")
public ResponseEntity sendPasswordResetEmail (@RequestParam("name") final String name,
@RequestParam("password") final String password,
@RequestParam("email") final String email)
{
final boolean success = notificationService.sendPasswordResetEmail(name, password, email);
return success ?
new ResponseEntity(HttpStatus.OK) : new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
我的问题是,调用以下时,它没有让我设置ResponseEntity.class作为第三个参数,它不没有道理,因为这是预期的返回类型:
ResponseEntity<String> auth = restTemplate.postForEntity(url, entity, ResponseEntity.class);
任何提示?
UPDATE:
这怎么可能,代码可以编译和运行,我得到这个消费终端是什么时候?
{
"timestamp": 1444927133682,
"status": 500,
"error": "Internal Server Error",
"exception": "java.lang.NoClassDefFoundError",
"message": "org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com/api/model/postmark/ResetPassword",
"path": "/v1/api/notify/sendPasswordResetEmail"
}
感谢的人。仍然没有工作(这是扔我一个400 BAD REQUEST),但至少语法错误消失了。 –
这就是我得到:“{ “时间戳”:1444927133682, “状态”:500, “错误”: “内部服务器错误”, “异常”: “java.lang.NoClassDefFoundError”, “消息“:”org.springframework.web.util.NestedServletException:处理程序处理失败;嵌套的异常是java.lang.NoClassDefFoundError:com/thortful/api/model/postmark/ResetPassword“, ”path“:”/ v1/api/notify/sendPasswordResetEmail“ }' –
@stackpepe如果您有新问题,请提出新问题。 –