title: Right work whit path at RESTful api with spring mvc, angular and hibernate
body: <p>I have a designprojects.jsp that I want will be runned after the LoginController and I want that my path will include current month and year and it will looks like this : ..../designprojects/2016/08/ 
  I want use this path with angularJS CRUD . how to make it right?
  What should i write for <code>REST_SERVICE_URI</code> in angular_service file? may be <code>REST_SERVICE_URI = '........./designprojects/{year}/{month}/';</code>?
  Thanks guys.....</p>
  
  <p>My LoginController : </p>
  
  <pre><code>@Controller
  public class LoginController {
  
  @Autowired
  private LoginService loginService;
  
  @RequestMapping(value = "/", method = RequestMethod.GET)
  public String index() {
      return "redirect:/login";
  }
  
  @RequestMapping(value = {"/login"}, method = RequestMethod.GET)
  public ModelAndView displayLogin(User user) {
      ModelAndView model = new ModelAndView("/login");
      model.addObject("user", user);
      return model;
  }
  
  @RequestMapping(value = "/login", method = RequestMethod.POST)
  public ModelAndView executeLogin(HttpServletRequest request, @ModelAttribute("user") User user) {
      ModelAndView modelAndView = null;
      if (user != null &amp;&amp; user.getUsername() != null &amp; user.getPassword() != null) {
          Employee employee = loginService.login(user.getUsername(), user.getPassword());
          if (employee != null) {
              request.getSession().setAttribute("employee_id", employee.getId());
              request.getSession().setAttribute("employee_name", employee.getFirstname());
              request.getSession().setAttribute("employee_role", (employee.getRole()).getRole());
              Date date= new Date();
              Calendar cal = Calendar.getInstance();
              cal.setTime(date);
              int month = cal.get(Calendar.MONTH)+1;
              int year = cal.get(Calendar.YEAR);
              modelAndView = new ModelAndView("redirect:/designprojects/" + year + "/" + month);
              return modelAndView;
          }
      }
      modelAndView = new ModelAndView("/login");
      request.setAttribute("errorMessage", "Invalid Username or Password");
      return modelAndView;
  }
  </code></pre>
  
  
  
  <p>My DesignProjectController : </p>
  
  <pre><code>@Controller
  public class DesignProjectsRestController {
  
  @Autowired
  DesignProjectService designProjectService;
  
  @RequestMapping(value = "/designprojects/{year}/{month}", method = RequestMethod.GET)
  public ResponseEntity&lt;List&lt;DesignProject&gt;&gt; listAllDesignProjects(@PathVariable(value="year") int year, @PathVariable(value="month") int month) {
      List&lt;DesignProject&gt; listOfProjects = designProjectService.getAllDesignProjects(year,month);
      return new ResponseEntity&lt;List&lt;DesignProject&gt;&gt;(listOfProjects, HttpStatus.OK);
  }
  
  @RequestMapping(value = "/designprojects/{year}/{month}/{id}", method = RequestMethod.GET)
  public ResponseEntity&lt;DesignProject&gt; getDesignProject(@PathVariable("id") int id) {
      DesignProject designProject = designProjectService.getDesignProjectsById(id);
      return new ResponseEntity&lt;DesignProject&gt;(designProject, HttpStatus.OK);
  }
  
  @RequestMapping(value = "/designprojects/{year}/{month}", method = RequestMethod.POST)
  public ResponseEntity&lt;Void&gt; createDesignProject(@RequestBody DesignProject designProject) {
      designProjectService.addDesignProject(designProject);
      return new ResponseEntity&lt;Void&gt;(HttpStatus.CREATED);
  }
  
  @RequestMapping(value = "/designprojects/{year}/{month}", method = RequestMethod.PUT)
  public ResponseEntity&lt;DesignProject&gt; updateDesignProject(@RequestBody DesignProject designProject) {
      designProjectService.updateDesignProjects(designProject);
      return new ResponseEntity&lt;DesignProject&gt;(designProject, HttpStatus.OK);
  }
  
  @RequestMapping(value = "/designprojects/{year}/{month}/{id}", method = RequestMethod.DELETE)
  public ResponseEntity&lt;Void&gt; deleteDesignProject(@PathVariable("id") int id) {
      designProjectService.deleteDesignProject(designProjectService.getDesignProjectsById(id));
      return new ResponseEntity&lt;Void&gt;(HttpStatus.NO_CONTENT);
  }
  
  
  }
  </code></pre>