【发布时间】:2020-01-26 13:49:33
【问题描述】:
我想在响应正文中为使用 Spring Boot 的 get 请求返回一个超链接,但我得到的是字符串作为响应而不是链接
@GetMapping("/getLinkToFile/{id}")
public URL getLinkToFile(@PathVariable int id) throws Exception {
URL base = new URL("https://file-examples.com/wp-content/uploads/2017/02/file_example_CSV_5000.csv");
return base;
}
【问题讨论】:
-
不清楚您在问什么 - 您是否想在浏览器中查看响应并期待可以点击的超链接?
-
你想要什么类型的响应
-
是的,我想要可点击的链接作为回应
标签: java spring-boot get request httpresponse