Spring MVC Controller: Redirect without parameters being added to my url

In Spring 3.1 a preferred way to control this behaviour is to add a RedirectAttributes parameter to your method: @RequestMapping(“save/”) public String doSave(…, RedirectAttributes ra) { … return “redirect:/success/”; } It disables addition of attributes by default and allows you to control which attributes to add explicitly. In previous versions of Spring it was more … Read more

How to create REST URLs without verbs?

General principles for good URI design: Don’t use query parameters to alter state Don’t use mixed-case paths if you can help it; lowercase is best Don’t use implementation-specific extensions in your URIs (.php, .py, .pl, etc.) Don’t fall into RPC with your URIs Do limit your URI space as much as possible Do keep path … Read more

When do I use path params vs. query params in a RESTful API?

Best practice for RESTful API design is that path params are used to identify a specific resource or resources, while query parameters are used to sort/filter those resources. Here’s an example. Suppose you are implementing RESTful API endpoints for an entity called Car. You would structure your endpoints like this: GET /cars GET /cars/:id POST … Read more