Bensson
Bensson

Reputation: 4589

How get ResourceUrl from Katharsis

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) 

Upvotes: 0

Views: 107

Answers (1)

Christian Bongiorno
Christian Bongiorno

Reputation: 5648

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

Upvotes: 0

Related Questions