首页 > 解决方案 > Java Spring REST 全部捕获子 URL

问题描述

有人知道使用 Java Spring REST 捕获子 URL 的好解决方案吗?

例如,我有网址:

http://example.com/hauses/toll/country/usa? ...

http://example.com/hauses/small/country/germany? ...

http://example.com/hauses/underground/country/norway? ...

...

其中一个的解决方案将是这样的:

@RestController
@RequestMapping("/hauses/underground/country")
public class ProxyController {

    @GetMapping("/norway")
    public String readSalesOrder(HttpServletRequest request) {
          some code
    }
}

但我需要捕捉“/hauses”之后的所有内容。像这样的东西:

@RequestMapping("/hauses/*")

有人知道解决方案吗?

非常感谢您的帮助!

标签: javaresturl

解决方案



推荐阅读