2016-11-09 71 views
0

405删除方法当我通过http://localhost:8080/cerebromodel/api/skillChecklists/staff/ {4} /清单访问此功能/ {1} 我得到405Spring + Hibernate的不支持

//delete custom 
    @RequestMapping(value = "/remove/staff/{sid}/checklist/{cid}", method = DELETE, produces = APPLICATION_JSON_VALUE) 
    public ResponseEntity<Void> deleteStaffChecklist(@PathVariable Long sid,@PathVariable Long cid) throws URISyntaxException { 
     try { 
      StaffSkillChecklist ssc = staffSkillChecklistRepository.deleteStaffChecklist(sid, cid); 
      staffSkillChecklistRepository.delete(ssc.getId()); 
      return ResponseEntity.ok().build(); 
     } catch (Exception x) { 
      // todo: dig exception, most likely org.hibernate.exception.ConstraintViolationException 
      return ResponseEntity.status(HttpStatus.CONFLICT).build(); 
     } 
    } 

缺少什么?

+2

也许你错误输入了它,但是你发布的URL在你的代码中没有“删除”。这肯定会导致405错误。 – Tim

+0

谢谢你蒂姆...我的网址是不正确的..我相信我自己 – coder310

回答

1

您的访问链接是http://localhost:8080/cerebromodel/api/skillChecklists/staff/{4}/checklist/{1}

而处理器已经URL作为

/remove/staff/{sid}/checklist/{cid} 

缺少您的访问链接删除提及。

相关问题