Spring 弹簧座删除404

Spring 弹簧座删除404,spring,rest,Spring,Rest,我有rest控制器和rest客户端。GET、POST、PUT都能很好地工作,但删除404上的重定向 控制器: @RequestMapping(value = "/rest/category/delete/{id}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) public void delete(@PathVariable("id") Long categoryId) { Category category

我有rest控制器和rest客户端。GET、POST、PUT都能很好地工作,但删除404上的重定向

控制器:

@RequestMapping(value = "/rest/category/delete/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)
public void delete(@PathVariable("id") Long categoryId) {
    Category category = categoryRepository.findOne(categoryId);
    if (category == null)
        throw new CategoryInDatabaseIsEmpty(categoryId);
    categoryRepository.delete(category);
}
和客户

    @RequestMapping(value = "/categories/delete/{id}", method = RequestMethod.GET)
    public String deleteCategory(@PathVariable("id") Long id) {
        restTemplate.delete(http://localhost:8080/InternetShop/rest/category/delete/ + id);
    return "redirect:/categories/page/" + 1;
}

对此有什么建议吗?

在传递到rest模板方法之前,必须追加第一个id。追加是什么意思?“String url=UrlRestUtil.DELETE_CATEGORY+id;restemplate.DELETE(url);”这有多大帮助?是的,传递了url字符串。不幸的是,这不起作用