title: Nested resources in Jersey/JAX-RS -how to implement Restangular example
body: <p>Thus may not actually be called nested resources from a Rest perspective, but I am interested in how to structure a Jersey class as a rest provider, so it can respond to chained requests.</p>
  
  <p>i.e I am ok with the basic /users, I am ok with /users/123 to get a specific user, but how to then branch down to properties of the user.... /users/123/cars,  /users/123/cars/23 etc.</p>
  
  <p>Sorry for the lack of information, but saw this as an example in the Restangular documentation for Angular.</p>
  
  <p><a href="https://github.com/mgonto/restangular#production-apps-using-">https://github.com/mgonto/restangular#production-apps-using-</a></p>
  
  <pre><code>restangular
  
  // Restangular returns promises
  Restangular.all('users').getList()  // GET: /users
  .then(function(users) {
    // returns a list of users
    $scope.user = users[0]; // first Restangular obj in list: { id: 123 }
  })
  
  // Later in the code...
  
  // Restangular objects are self-aware and know how to make their own RESTful requests
  $scope.user.getList('cars');  // GET: /users/123/cars
  
  // You can also use your own custom methods on Restangular objects
  $scope.user.sendMessage();  // POST: /users/123/sendMessage
  
  // Chain methods together to easily build complex requests
  $scope.user.one('messages', 123).one('from', 123).getList('unread');
  // GET: /user/123/messages/123/from/123/unread
  </code></pre>