I have a Spring MVC application with REST controllers, which works as a back-end for a JavaScript, Angular-based front-end application. It is sometimes necessary to return to the front-end a relative URL to a resource.
The question is: what should the relative URL start from?
Assuming that the absolute URL is http://host:port/context-path/servlet-path/service/id, I see the following options:
- context path: /context-path/servlet-path/service/id
- servlet path: /servlet-path/service/id
- request mapping only: /service/id
The front-end application is deployed in the same Web application as the back-end, but in a different directory, e.g. http://host:port/context-path/gui-app/.