I am trying to get the request URL in a RestController. The RestController has multiple methods annotated with @RequestMapping
for different URIs and I am wondering how I can get the absolute URL from the @RequestMapping
annotations.
@RestController
@RequestMapping(value = "/my/absolute/url/{urlid}/tests"
public class Test {
@ResponseBody
@RequestMapping(value "/",produces = "application/json")
public String getURLValue(){
//get URL value here which should be in this case, for instance if urlid
//is 1 in request then "/my/absolute/url/1/tests"
String test = getURL ?
return test;
}
}