【发布时间】:2022-11-20 21:57:58
【问题描述】:
public String deleteProduct(@RequestBody String prodId ,HttpServletRequest request ) throws NotLoggedInException {
String userName = (String) request.getSession().getAttribute("user");
System.out.println(userName);
if (userName == null) {
throw new NotLoggedInException("You have not logged in");
}
String userRole = (String) request.getSession().getAttribute("role");
if (!userRole.equalsIgnoreCase("productmaster")) {
throw new AuthorizedUserRoleNotFoundException("you are not authorized to add the products");
}
if(pservice.deleteProduct(prodId))
{
return "Product deleted";
}
return "Product not deleted";
}
输出: { “时间戳”:“2022-11-20T13:17:24.172+0000”, “状态”:400, “错误”:“错误的请求”, “消息”:“缺少必需的请求正文:public java.lang.String }
请告诉别人为什么会这样显示
【问题讨论】:
-
你如何称呼这个东西?你认为错误消息试图告诉你什么?
标签: java spring spring-boot