title: spring mvc request mapping inheritance
body: <p>I have a Spring MVC 3.2 app and I am trying to find the best way to handle my URLs.  I am looking to support multiple customers with something like this:</p>
  
  <pre><code>www.myproduct.com/customerNameX/products
  www.myproduct.com/customerNameX/office/
  www.myproduct.com/customerNamex/financial
  www.myproduct.com/customerNamex/...
  </code></pre>
  
  <p>I would like to have a controller for each of the path after customerName.  I was hoping there was a way to do some sort of inheritance request mapping in Spring MVC.  Here is my current attempt that results in deploy errors("Ambiguous mapping found. Cannot map 'rootController' bean method ") </p>
  
  <pre><code>@Controller
  @RequestMapping( "/{officeId}/" )
  public class RootController  {
  
      public @ResponseBody
      Office getOffice( @PathVariable String officeId ) {
  
      return offficeService.findOfficeByName(officeId);
      }
   }
  
  @Controller
  @RequestMapping( "/{officeId}/products" )
  public class ProductsController  extends RootController {
  ...
  }
  
  @Controller
  @RequestMapping( "/{officeId}/office" )
  public class OfficeController  extends RootController {
  ...
  }
  </code></pre>
  
  <p>The thought being that the root controller would get the first level requests, and the officeId would tell all other requests what officeId is being requests. But I don't think this is the correct approach.</p>
  
  <p>I would really appreciate any tips on the best way to build my URL's properly.</p>