java - How to use environment variable in urlrewrite.xml? - Stack Overflow

My tomcat process has -DcontextName=companyApp but I am unable to use this in my urlrewrite.xml file<

My tomcat process has -DcontextName=companyApp but I am unable to use this in my urlrewrite.xml file


<?xml version="1.0" encoding="utf-8"?>
<!--
    Configuration file for UrlRewriteFilter
    /
-->
<urlrewrite use-query-string="true" default-match-type="wildcard">
<rule>
        <from>${contextName}</from>
        <to type="permanent-redirect" last="true">abc</to>
</rule>
</urlrewrite>

the redirect does not work. I think the ${contextName} is not getting resolved.

Note that I have set default-match-type="wildcard" to remove any doubts about any clash with regex engine.

Edit: I also tried to use %{context-path}, which is a variable provided by url rewrite filter, to do the same job but that did not work either, which is why I am using this approach.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744909688a4600472.html

相关推荐

  • java - How to use environment variable in urlrewrite.xml? - Stack Overflow

    My tomcat process has -DcontextName=companyApp but I am unable to use this in my urlrewrite.xml file<

    1天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信