简体   繁体   English

不同控制器中的Spring Boot句柄请求按传入域区分

[英]Spring boot handle request in different controller differentiate by incoming domain

Existing @RequestMapping annotation can only delegate request path to different controllers & methods but not checking request domain itself. 现有的@RequestMapping批注只能将请求路径委派给不同的控制器和方法,而不能检查请求域本身。

Is it possible to set spring boot to handle request from "www.domainA.com" & "www.domainB.com" to respond differently by using the different controller? 是否可以将spring boot设置为处理来自“ www.domainA.com”和“ www.domainB.com”的请求,以使用不同的控制器做出不同的响应?

Thanks. 谢谢。

Browsers send the Domain in the HTTP Header "Host". 浏览器在HTTP标头“主机”中发送域。

@RequestMapping.headers can be used to match only requests for a specific domain. @ RequestMapping.headers可用于仅匹配特定域的请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM