<?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>How to create ServletFilter for url-pattern '/'</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121655175" />
  <subtitle>How to create ServletFilter for url-pattern '/'</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=121655175</id>
  <updated>2026-04-05T15:01:25Z</updated>
  <dc:date>2026-04-05T15:01:25Z</dc:date>
  <entry>
    <title>RE: How to create ServletFilter for url-pattern '/'</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121662710" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121662710</id>
    <updated>2023-03-03T16:22:33Z</updated>
    <published>2023-03-03T14:21:53Z</published>
    <summary type="html">&lt;p&gt;Liferay 7 already has support for OAuth2 and PKCE authentication flows.&lt;/p&gt;
&lt;p&gt;Perhaps your whole customization for Liferay 6 is now moot and you
  can exclude it completely?&lt;/p&gt;</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2023-03-03T14:21:53Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to create ServletFilter for url-pattern '/'</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121662639" />
    <author>
      <name>Philipp Glatzl</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121662639</id>
    <updated>2023-03-03T16:56:24Z</updated>
    <published>2023-03-03T09:45:48Z</published>
    <summary type="html">&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;thanks for the response.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Actually i am trying to evaluate GET parameters that are passed to
  the &amp;quot;/&amp;quot; path.&lt;/p&gt;
&lt;p&gt;In case they are available and valid, then i store them into the
  session for later use.&lt;br /&gt; ​​​​​​In case they are available and
  invalid, i want to return a specifc HTTP error code.&lt;/p&gt;
&lt;p&gt;The base idea behind is, to launch a PKCE authentication
  workflow.&lt;br /&gt; This worked in Liferay 6, but I have troubles to get
  this running in Liferay 7&lt;br /&gt; ​​​&lt;/p&gt;</summary>
    <dc:creator>Philipp Glatzl</dc:creator>
    <dc:date>2023-03-03T09:45:48Z</dc:date>
  </entry>
  <entry>
    <title>RE: How to create ServletFilter for url-pattern '/'</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121660110" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121660110</id>
    <updated>2023-03-01T19:24:03Z</updated>
    <published>2023-03-01T18:15:13Z</published>
    <summary type="html">&lt;p&gt;We don't use filters/hooks anymore.&lt;/p&gt;
&lt;p&gt;Now we use OSGi.&lt;/p&gt;
&lt;p&gt;Search the portal source looking for implementations of
  javax.servlet.Filter and you'll find examples how to do it.&lt;/p&gt;
&lt;p&gt;Note though that &amp;quot;/&amp;quot; as a url pattern isn't going to get
  you far because Liferay automatically redirects to appropriate places.&lt;/p&gt;
&lt;p&gt;Can you share what you need to do? I might be able to offer a better solution...&lt;/p&gt;</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2023-03-01T18:15:13Z</dc:date>
  </entry>
  <entry>
    <title>How to create ServletFilter for url-pattern '/'</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121655174" />
    <author>
      <name>Philipp Glatzl</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=121655174</id>
    <updated>2023-02-21T20:04:18Z</updated>
    <published>2023-02-21T16:51:14Z</published>
    <summary type="html">&lt;div class="c-message_kit__blocks c-message_kit__blocks--rich_text"&gt;
  &lt;div class="c-message__message_blocks c-message__message_blocks--rich_text"&gt;
    &lt;div class="p-block_kit_renderer"&gt;
      &lt;div class="p-block_kit_renderer__block_wrapper p-block_kit_renderer__block_wrapper--first"&gt;
        &lt;div class="p-rich_text_block"&gt;
          &lt;div class="p-rich_text_section"&gt;Hi,&lt;br /&gt; i am running on
            7.4.3.48-ga48 . I wanted to create a servlet filter in a
            hook, but it is not called at all.&lt;br /&gt; I have the
            following filter definition inside the liferay-hook.xml:&lt;/div&gt;
          &lt;pre&gt;
&lt;code class="language-html"&gt;    &amp;lt;servlet-filter&amp;gt;
        &amp;lt;servlet-filter-name&amp;gt;Some Filter&amp;lt;/servlet-filter-name&amp;gt;
        &amp;lt;servlet-filter-impl&amp;gt;at.....SomeFilter&amp;lt;/servlet-filter-impl&amp;gt;
    &amp;lt;/servlet-filter&amp;gt;
	&amp;lt;servlet-filter-mapping&amp;gt;
        &amp;lt;servlet-filter-name&amp;gt;Some Filter&amp;lt;/servlet-filter-name&amp;gt;
        &amp;lt;url-pattern&amp;gt;/&amp;lt;/url-pattern&amp;gt;
    &amp;lt;/servlet-filter-mapping&amp;gt;&lt;/code&gt;&lt;/pre&gt;
          &lt;pre class="c-mrkdwn__pre"&gt;
 &lt;/pre&gt;
          &lt;div class="p-rich_text_section"&gt;It seems that the url-pattern
            '/' is not accepted. What can i do, that the servlet filter
            is invoked on the root path? Is there a different approach possible?&lt;/div&gt;
          &lt;div class="p-rich_text_section"&gt; &lt;/div&gt;
          &lt;div class="p-rich_text_section"&gt;Thank you in advance,&lt;/div&gt;
          &lt;div class="p-rich_text_section"&gt;Philipp&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</summary>
    <dc:creator>Philipp Glatzl</dc:creator>
    <dc:date>2023-02-21T16:51:14Z</dc:date>
  </entry>
</feed>
