Foren

how to implement filter in liferay and redirect to URL

Abutalib Shaikh, geändert vor 7 Jahren.

how to implement filter in liferay and redirect to URL

Junior Member Beiträge: 36 Beitrittsdatum: 17.05.16 Neueste Beiträge
Hi ,

we implement hook for filter mapping , filter works fine
- but we have following scenario :
1. if user is belongs to "test" group then
redirect to for e.g. "www.test.com" i used http sendredirect() method for that
- but problem is that seems no redirection is done

2. if user is not belongs to "test" group
do nothing, proceed as normal
do chain (); method call

- i implement filter and print some statements in do filter () method
- when hit a request method was call but for 1 request 15 times that statement (dofilter () method is calling)
- so may overheads on Database check every time user belongs to that group or not please suggest any alternative way for this

so please suggest way how i proceed and URL redirection issue


thank you in advance emoticon
thumbnail
Andrew Jardine, geändert vor 5 Jahren.

RE: how to implement filter in liferay and redirect to URL

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Hi Abutalib,

Your approach sounds correct -- can you share your code with us? Perhaps if we see the actual lines something will jump out for one of us.
thumbnail
Victor Zorin, geändert vor 5 Jahren.

RE: how to implement filter in liferay and redirect to URL

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
Generally it depends on how the filter is mapped,
e.g. if somehow your filter has been on the invocation of portlet render urls and there 15 of them to be called on the page, you filter will be called 15 times.
On another note, very likely that the database will not be called 15 times, only once due to caching. However it is still an overhead.
Abutalib Shaikh, geändert vor 5 Jahren.

RE: how to implement filter in liferay and redirect to URL

Junior Member Beiträge: 36 Beitrittsdatum: 17.05.16 Neueste Beiträge
Thank's for the feedback,

I have achieve this by using service pre action with hook plugin