How to override portal-impl jar classes in Liferay ext-plugin

丶灬走出姿态 提交于 2019-12-11 06:25:37

问题


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.

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>

Note: The idea is to solve this problem


回答1:


As the NtlmFilter is no Spring bean, there is no use to define it in ext-spring.xml.

See portal.properties:

# ... and the filter
# com.liferay.portal.servlet.filters.sso.ntlm.NtlmFilter must be referenced
# in web.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).

The same applies to the NtlmPostFilter.



来源:https://stackoverflow.com/questions/45915136/how-to-override-portal-impl-jar-classes-in-liferay-ext-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!