admin管理员组

文章数量:1405297

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.

本文标签: javaHow to use environment variable in urlrewritexmlStack Overflow