Question: I have a REST endpoint implemented with Spring MVC @RestController. Sometime, depends on input parameters in my controller I need to send http redirect on client. 

Is it possible with Spring MVC @RestController and if so, could you please show an example ?

Answer: 
Add an `HttpServletResponse` parameter to your Handler Method then call `response.sendRedirect("some-url");`

Something like:

```
@RestController
public class FooController {

  @RequestMapping("/foo")
  void handleFoo(HttpServletResponse response) throws IOException {
    response.sendRedirect("some-url");
  }

}

```
if you @RestController returns an **String** you can use something like this

```
return "redirect:/other/controller/";

```

and this kind of redirect is only for **GET** request, if you want to use other type of request use HttpServletResponse