使用tuckey,当存在特定参数时,从URL中删除所有查询字符串参数

时间:2014-06-13 19:26:43

标签: spring tomcat spring-mvc url-rewriting tuckey-urlrewrite-filter

我刚刚介绍了tuckey并且正在玩pentaho服务器(spring)中重写url查询参数。

我想做什么: 重写

http://hostname:8080/pentaho/api/repos/:public:Steel%20Wheels:Regional%20Sales%20%28dashboard%29.xdash/viewer?token=ABC-1234-42rheRFrhewu2425-ticket&username=popcorn

http://hostname:8080/pentaho/api/repos/:public:Steel%20Wheels:Regional%20Sales%20%28dashboard%29.xdash/viewer

对我不起作用的事情:

<rule>
    <from>^/viewer$</from>
    <to type="redirect" last="true">/viewer</to>
</rule>

<rule>
    <condition type="parameter" name="token" operator="equal">(*)</condition>
    <from>^/viewer$</from>
    <to type="permanent-redirect" last="true">viewer</to>
</rule>

和许多变种。检查旧帖也。我知道我可能正在做正则表达式的错误或配置完全关闭。任何指针都表示赞赏。

1 个答案:

答案 0 :(得分:0)

完全忘记了这个问题,因为没有人回应。如果有人发现自己处于同一位置,应该回答自己。

<rule>
    <condition type="parameter" name="token" operator="equal">(*)</condition>
    <from>^/viewer(.*)$</from>
    <to type="permanent-redirect" last="true">viewer</to>
</rule>