Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to create ServletFilter for url-pattern '/'
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.
I have the following filter definition inside the liferay-hook.xml:
<servlet-filter>
<servlet-filter-name>Some Filter</servlet-filter-name>
<servlet-filter-impl>at.....SomeFilter</servlet-filter-impl>
</servlet-filter>
<servlet-filter-mapping>
<servlet-filter-name>Some Filter</servlet-filter-name>
<url-pattern>/</url-pattern>
</servlet-filter-mapping>
We don't use filters/hooks anymore.
Now we use OSGi.
Search the portal source looking for implementations of javax.servlet.Filter and you'll find examples how to do it.
Note though that "/" as a url pattern isn't going to get you far because Liferay automatically redirects to appropriate places.
Can you share what you need to do? I might be able to offer a better solution...
Hi,
thanks for the response.
Actually i am trying to evaluate GET parameters that are passed to the "/" path.
In case they are available and valid, then i store them into the
session for later use.
In case they are available and
invalid, i want to return a specifc HTTP error code.
The base idea behind is, to launch a PKCE authentication
workflow.
This worked in Liferay 6, but I have troubles to get
this running in Liferay 7
Liferay 7 already has support for OAuth2 and PKCE authentication flows.
Perhaps your whole customization for Liferay 6 is now moot and you can exclude it completely?
Powered by Liferay™