如何在Liferay ext-plugin中覆盖Portal-Impl jar类 [英] How to override portal-impl jar classes in Liferay ext-plugin
问题描述
我想覆盖两个portal-impl.jar类 NtlmFiler.java 和 NtlmPostFilter.java ,我创建了一个ext-plugin项目并放置了自定义的书面类在ext-impl/src中,但是我无法将spring.xml文件配置为使用新编写的类而不是portal-impl类,也许我完全不赞成这样做.
I want to override two portal-impl.jar classes NtlmFiler.java and NtlmPostFilter.java, I have created an ext-plugin project and placed my custom written classes in ext-impl/src but I am unable to configure my spring.xml file to use my newly written classes instead of portal-impl classes, maybe i am totally wrong about doing it this way.
我的ext-spring.xml代码是:
My ext-spring.xml code is :
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<bean id="com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter"
class="com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter">
<property name="ntlmFilter">
<bean class="com.sso.ntlm.filter.CustomNtlmFilter">
<property name="CustomNtlmFilter" ref="customNtlmFilter" />
</bean>
</property>
</bean>
<bean id="com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter"
class="com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter">
<property name="ntlmPostFilter">
<bean class="com.sso.ntlm.filter.CustomNtlmPostFilter">
<property name="CustomNtlmPostFilter" ref="customNtlmPostFilter" />
</bean>
</property>
</bean>
注意:该想法是解决这个问题
推荐答案
由于NtlmFilter
不是Spring bean,因此在ext-spring.xml
中没有用它来定义它.
As the NtlmFilter
is no Spring bean, there is no use to define it in ext-spring.xml
.
请参见portal.properties
:
# ... and the filter
# com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter must be referenced
# in web.xml.
因此,您只需要在liferay-web.xml
或web-ext.xml
中引用过滤器类即可(我不知道后者是否适用于覆盖).
So you just need to reference your filter class instead in liferay-web.xml
or web-ext.xml
(I don't know if the later works for overrides).
NtlmPostFilter
也是如此.
这篇关于如何在Liferay ext-plugin中覆盖Portal-Impl jar类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!