留言板

Two Filters in the same Hook

thumbnail
Michele Zanarotti,修改在10 年前。

Two Filters in the same Hook

Junior Member 帖子: 94 加入日期: 12-2-20 最近的帖子
Hello. I'm using an hook and defined two filters.

At first i tried defining them like this :
public class Filter1 extends BaseFilter { ...
public class Filter2 extends BaseFilter {...


These filters are added to the liferay-hook.xml file and mapped to the same path. The Filter1 mapping is defined as the first of the two , so it should execute first.
Despite all that the filters are not working at the same time giving me the error on Filter1:
... Error : Please Implement processFilter (....


So i have changed the first filter defining it in another way like this :
public class Filter1 implements javax.servlet.Filter { ...


This time the filter is working, but after the execution, it's not going to call the next Filter2.

What is the correct way to define two consecutive filters in a hook ?

PS : i'm stick with the last type of filter definition (the javax.servlet.Filter) simply because this will substituted by a third-party, closed source, filter, so it will be hardly a liferay filter.