<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>OSGi component override for Servlet Filter needs to be manually redeployed</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119790859" />
  <subtitle>OSGi component override for Servlet Filter needs to be manually redeployed</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119790859</id>
  <updated>2026-04-04T20:15:56Z</updated>
  <dc:date>2026-04-04T20:15:56Z</dc:date>
  <entry>
    <title>RE: OSGi component override for Servlet Filter needs to be manually redeplo</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119795193" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119795193</id>
    <updated>2020-08-18T20:21:30Z</updated>
    <published>2020-08-18T20:21:30Z</published>
    <summary type="html">Also check the comment in &lt;a href="https://github.com/liferay/liferay-blade-samples/blob/7.2/liferay-workspace/extensions/servlet-filter/src/main/java/com/liferay/blade/samples/servletfilter/BladeServletFilter.java"&gt;https://github.com/liferay/liferay-blade-samples/blob/7.2/liferay-workspace/extensions/servlet-filter/src/main/java/com/liferay/blade/samples/servletfilter/BladeServletFilter.java&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;particularly the link to &lt;a href="https://issues.liferay.com/browse/LPS-107575"&gt;https://issues.liferay.com/browse/LPS-107575&lt;/a&gt;</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2020-08-18T20:21:30Z</dc:date>
  </entry>
  <entry>
    <title>RE: OSGi component override for Servlet Filter needs to be manually redeplo</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119792275" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119792275</id>
    <updated>2020-08-18T17:27:47Z</updated>
    <published>2020-08-18T17:27:47Z</published>
    <summary type="html">I agree, it should be controlled by service ranking.&lt;br /&gt;I could be totally off, but I believe these classes are relevant:&lt;br /&gt;&lt;a href="https://github.com/liferay/liferay-portal/blob/7.3.x/portal-kernel/src/com/liferay/portal/kernel/servlet/filters/invoker/InvokerFilterHelper.java"&gt;https://github.com/liferay/liferay-portal/blob/7.3.x/portal-kernel/src/com/liferay/portal/kernel/servlet/filters/invoker/InvokerFilterHelper.java&lt;/a&gt;&lt;br /&gt;Looks like a map &amp;lt;filtername, filter&amp;gt; and if a new filter with the same name appears, it replaces the previous filter. It probably should check the service ranking of the filter or something like that and only then replace it in the map.</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2020-08-18T17:27:47Z</dc:date>
  </entry>
  <entry>
    <title>RE: OSGi component override for Servlet Filter needs to be manually redeplo</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119791904" />
    <author>
      <name>Krzysztof Gołębiowski</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119791904</id>
    <updated>2020-08-18T14:27:00Z</updated>
    <published>2020-08-18T14:27:00Z</published>
    <summary type="html">Thanks for the suggestion, it worked! Actually that makes sense, now the Filter is started after all the others are initialized so it overrides the default &lt;strong&gt;CASFilter&lt;/strong&gt;. I&amp;#39;ll update my blog so the knowledge is saved &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif" &gt;&lt;br /&gt;I feel though that this is still kind of a workaround and there should be some way to override servlet Filters declaratively but I also think this is how it was implemented in Liferay for now so... we cannot do anything more.</summary>
    <dc:creator>Krzysztof Gołębiowski</dc:creator>
    <dc:date>2020-08-18T14:27:00Z</dc:date>
  </entry>
  <entry>
    <title>RE: OSGi component override for Servlet Filter needs to be manually redeplo</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119791552" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119791552</id>
    <updated>2020-08-18T13:56:27Z</updated>
    <published>2020-08-18T13:56:27Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Maybe it helps if your module is activated later?&lt;br&gt;&lt;a href="https://help.liferay.com/hc/en-us/articles/360018168631-Waiting-on-Lifecycle-Events-"&gt;https://help.liferay.com/hc/en-us/articles/360018168631-Waiting-on-Lifecycle-Events-&lt;/a&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;[code]   @Reference(target = ModuleServiceLifecycle.PORTAL_INITIALIZED)
    private ModuleServiceLifecycle _portalInitialized;&lt;/code&gt;&lt;/pre&gt;That way, your module is only activated when the portal is initialized. No idea if it makes a difference but since it is easy to test ...&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2020-08-18T13:56:27Z</dc:date>
  </entry>
  <entry>
    <title>OSGi component override for Servlet Filter needs to be manually redeployed</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119790858" />
    <author>
      <name>Krzysztof Gołębiowski</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119790858</id>
    <updated>2020-08-18T13:26:30Z</updated>
    <published>2020-08-18T13:26:30Z</published>
    <summary type="html">Hello Everyone,&lt;br /&gt;Some time ago I created an OSGi service override for &lt;strong&gt;CASFilter&lt;/strong&gt; to support multiple domains for different sites. I&amp;#39;ve described everything in &lt;a href="https://liferay.dev/blogs/-/blogs/overriding-casfilter-in-liferay-7-3-to-support-multiple-domains"&gt;this blog post&lt;/a&gt;, so you can see the entire solution straight away (the actual implementation is in &lt;a href="https://github.com/kgolebiowski/liferay-multidomain-cas-integration/blob/master/modules/liferay-multidomain-cas-filter/src/main/java/ski/golebiow/liferay/security/sso/cas/internal/servlet/filter/MultidomainCASFilter.java"&gt;MultidomainCASFilter&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;My module works very well until the server is restarted when it gets disabled and in order to reenable, I have to deploy the plugin again. I think the reason behind this might be the default &lt;em&gt;static&lt;/em&gt; reference policy, which says the container to use the old component until it is explicitly reactivated or becomes unavailable. &lt;br /&gt;&lt;br /&gt;First, I was thinking about reconfiguring the service reference with OSGi &lt;em&gt;.config&lt;/em&gt; file as it is written &lt;a href="https://help.liferay.com/hc/en-us/articles/360028808412-Reconfiguring-Components-to-Use-Your-OSGi-Service#reconfiguring-the-service-reference"&gt;here&lt;/a&gt;. The problem though is that filters are not explicitly referenced as they are part of Filter Chain, so I assume they are dynamically resolved somewhere deep in the Liferay code.&lt;br /&gt;&lt;br /&gt;Any ideas about how to fix it?&lt;br /&gt;KG</summary>
    <dc:creator>Krzysztof Gołębiowski</dc:creator>
    <dc:date>2020-08-18T13:26:30Z</dc:date>
  </entry>
</feed>
