我有休息控制器和休息客户端。 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;
}
有关于此的任何建议吗?