【问题标题】:Provide URL with @PathVariable使用 @PathVariable 提供 URL
【发布时间】:2019-08-01 05:14:29
【问题描述】:

我想在url中发送一个链接,例如

https://localhost:8080/https://www.google.com

但是,这个解决方案不起作用

@GetMapping("/{url}")
public void writeUrl(@PathVariable String url) {
    System.out.println(url);
}

我需要在@PathVariable 或@RequestParam 中(不在@Body 中)

【问题讨论】:

标签: spring


【解决方案1】:
@GetMapping("/")
public void writeUrl(@RequestParam("url") String url) {
    System.out.println(url);
}

然后:

https://localhost:8080/?url=https://www.google.com

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-18
    • 1970-01-01
    • 2017-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-30
    • 1970-01-01
    相关资源
    最近更新 更多