我正在使用带有RestTemplate的Spring Data REST HATEOAS HAL。在此示例中,我想将http://localhost:18080/api/customers/3
更改为http://localhost:18080/api-management/customer/api/customers/3
。有什么办法可以做到的?
实际上,我正在执行包装程序,该包装程序调用实际域API并获取响应。自然会生成HATEOAS链接,这些链接是域API的,但是对于像Consumers这样的外部世界,我想显示包装命名链接。
{
"links" : [ {
"rel" : "self",
"href" : "http://localhost:18080/api/customers?page=0&size=100{&sort}"
}, {
"rel" : "search",
"href" : "http://localhost:18080/api/customers/search"
}, {
"rel" : "customer",
"href" : "http://localhost:18080/api/customers/1"
}, {
"rel" : "customer",
"href" : "http://localhost:18080/api/customers/2"
}, {
"rel" : "customer",
"href" : "http://localhost:18080/api/customers/3"
}, {
"rel" : "customer",
"href" : "http://localhost:18080/api/customers/4"
}, {
"rel" : "customer",
"href" : "http://localhost:18080/api/customers/5"
} ],
"content" : [ ],
"page" : {
"size" : 100,
"totalElements" : 5,
"totalPages" : 1,
"number" : 0
}
}