How get ResourceUrl from Katharsis

110 Views Asked by At

When I try to rewrite Katharsis self link, I need add resource url as prefix.

e.g: "self": "http://localhost/table-name/A" Where I can get http://localhost/table-name.

I found ResourceRegistry provider this method. but I am not able to get ResourceRegistry instance。 Is any good way to get ResourceUrl ?

ResourceRegistry
 public String getResourceUrl(Class<?> clazz) 
1

There are 1 best solutions below

0
On

The localhost part will be picked up from the host header. The prefix can be set in your application properties file. I think it's literally called api.prefix. If you want to override the local host part programmatically you can implement a bean of type

ServiceUrlProvider and declare it @Primary

Look at the spring boot example config