I have my web application deployed to tomcat with an applicatio context. For example my URL looks something like this.
http://localhost:8080/myapp
I'm also using tomcat and Spring MVC. Using relative url in JavaScript will do the trick.
For doing this you just need to remove the / at the begining of REST url. so that your url starts from the current url in your browser.
/
replace $resource('/getusers') with $resource('getusers')
$resource('/getusers')
$resource('getusers')