title: Spring MVC : Redirecting from a base controller - How to get the path to redirect to?
body: <p>I have searched and searched and have not found anything that says this is not possible, nor anything that explains how to do it.</p>
  
  <p>If you have a Base Controller that is extended I understand that the request mapped methods are also inherited.</p>
  
  <p>So with....</p>
  
  <pre><code>public abstract class BaseController
  {
  
      @RequestMapping(value="hello", method=RequestMethod.GET)
      public String hello(Model model) {
          return "hello-view;
  }
  </code></pre>
  
  <p>...a Controller like so ...</p>
  
  <pre><code>@Controller
  @RequestMapping("/admin/")
  public abstract class AdminController
  {
   ....
  }
  </code></pre>
  
  <p>...will inherit a method listening at /admin/hello that returns the hello-view.</p>
  
  <p>This is all fine.</p>
  
  <p>But what if I have a BaseController method that redirects:</p>
  
  <pre><code>public abstract class BaseController
  {
  
      @RequestMapping(value="hello", method=RequestMethod.POST)
      public String hello(Model model) {
          return "redirect:/success/;
  }
  </code></pre>
  
  <p>As I understand it the redirect requires either a relative or absolute URL rather than a viewname?</p>
  
  <p>So how does my AdminController ensure the redirect takes place to /admin/success/?</p>
  
  <p>How does the BaseController method get a handle on the class level @requestMapping on my AdminController?</p>
  
  <p>Is this possible?</p>