【问题标题】:Spring Expression language - map values based on url (based on the path without host and port)Spring Expression 语言 - 基于 url 映射值(基于没有主机和端口的路径)
【发布时间】:2020-09-14 13:13:51
【问题描述】:

我正在尝试在 SpEL(Spring 表达式语言)中映射一个值。

我需要根据url路径映射某些值

https://www1.qa4.testsite.com/sso-login : External
https://www1.qa4.testsite.com/www : Normal
https://www.testsite.com/main/personal : Marketing

除了检查整个字符串值之外,实现该值的表达式是什么。只需要表达式来检查路径('sso-logn' , 'www' , 'main/personal')

#map(#requestInfo.httpReferer, {'https://www1.qa4.testsite.com/sso-login': 'External', 'https://www.testsite.com/main/personal': 'Marketing', 'https://www1.qa4.testsite.com/www': 'Normal'}, 'Normal')

【问题讨论】:

    标签: java spring spring-el


    【解决方案1】:

    得到一个有效的表达方式

    #map(#requestInfo?.httpReferer?.split("m/")?.$[true], {'sso-login': 'External', 'www': 'Marketing', 'main/personal': 'Normal'}, 'Normal')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-13
      • 1970-01-01
      • 2016-01-04
      • 2013-01-19
      • 1970-01-01
      • 2013-07-21
      • 1970-01-01
      • 2014-10-16
      相关资源
      最近更新 更多