I am trying to make configurable logging application for Liferay 7.4.3 with Apache Maven. I have no problem making the app configurable using this approach, when compiling the project as a OSGi bundle (using bnd-maven-plugin).
However I need to register the hook in the webapp/WEB-INF/liferay-hook.xml such as:
<?xml version="1.0"?>
<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 7.1.0//EN" "http://www.liferay.com/dtd/liferay-hook_7_1_0.dtd">
<hook>
<servlet-filter>
<servlet-filter-name>My Hook</servlet-filter-name>
<servlet-filter-impl>MyHook</servlet-filter-impl>
</servlet-filter>
<servlet-filter-mapping>
<servlet-filter-name>My Hook</servlet-filter-name>
<before-filter>SSO Open SSO Filter</before-filter>
<url-pattern>/*</url-pattern>
</servlet-filter-mapping>
</hook>
Is there a way to combine both hook and a configurable app into single application? i.e. Compiling a OSGi bundle in such a way that would contain hook registration in webapp/WEB-INF/liferay-hook.xml?
I have a working implementation of application with hook using that approach, however it is compiled as a WAR to include the WEB-INF folder.
I tried compiling the app as a WAB using both bnd-maven-plugin and maven-bundle-plugin to no avail.
There's no need for the 6.x style hooks. You can implement a servlet filter following this example: