Foros de discusión

looking for custom landing page hook suggestions

Craig Laidlaw, modificado hace 9 años.

looking for custom landing page hook suggestions

New Member Mensajes: 5 Fecha de incorporación: 26/11/13 Mensajes recientes
Hello, here is my dilemma.

We are scaling out to have several public facing template-based sites with each site hosting a blog area where we want to allow comments. So each user will initially (pre-login) land on a site with a blog page named /web/site1/blog , /web/site2/blog , /web/site3/blog etc.

Once the user logs in I would like to return them to their original site's blog page.

A user may belong to more than one site so I can't just grab a list of sites they belong to and go to the first one. I need to know which site/url they came from to return them, assuming through a post.login hook, to their original location.

I have a post.login hook in place but I can't seem to find the right combination of local service utils, objects, or methods to retrieve that original site url. The httpservletrequest tells me the getContextPath is empty, getPathInfo is null, the getRequestURI is /c whether I look at the passed in httpservletrequest or the PortalUtil's getOriginalServletRequest.

Any suggestions on how I can retrieve the original site name in the hook or is there a better approach to architecting this solution?

Thx,
Craig
thumbnail
Nagendra Kumar Busam, modificado hace 9 años.

RE: looking for custom landing page hook suggestions

Liferay Master Mensajes: 678 Fecha de incorporación: 7/07/09 Mensajes recientes
Can you have a look at below plugin & see

https://www.liferay.com/marketplace/-/mp/application/17676547
Craig Laidlaw, modificado hace 9 años.

RE: looking for custom landing page hook suggestions

New Member Mensajes: 5 Fecha de incorporación: 26/11/13 Mensajes recientes
Hi Nagendra,
Thank you for the reply.

I downloaded and tried out the Custom Landing Page Hook yesterday but hit the issue where a user can belong to more than one site.

The logic for setting up the lastPath variable for sitePublicPage defaults to the first site in the listing if a user belongs to more than one instead of the site that the user came from.

Thank you for that suggestion though.

Craig
thumbnail
Nagendra Kumar Busam, modificado hace 9 años.

RE: looking for custom landing page hook suggestions

Liferay Master Mensajes: 678 Fecha de incorporación: 7/07/09 Mensajes recientes
Can you have a look at GroupThreadLocal to get groupId, set LAST_PATH accordingly
Craig Laidlaw, modificado hace 9 años.

RE: looking for custom landing page hook suggestions

New Member Mensajes: 5 Fecha de incorporación: 26/11/13 Mensajes recientes
Sorry I failed to mention we are still on 6.1.2-ce-ga3. It looks like GroupThreadLocal came aboard in 6.2 perhaps?

Is there a 6.1.x equivalent?
thumbnail
Nagendra Kumar Busam, modificado hace 9 años.

RE: looking for custom landing page hook suggestions

Liferay Master Mensajes: 678 Fecha de incorporación: 7/07/09 Mensajes recientes
Can you have a look at ServicePreAction.java, probably you can find some thing there
thumbnail
Tejas Kanani, modificado hace 9 años.

RE: looking for custom landing page hook suggestions

Liferay Master Mensajes: 654 Fecha de incorporación: 6/01/09 Mensajes recientes
Hi Craig,

A user may belong to more than one site so I can't just grab a list of sites they belong to and go to the first one. I need to know which site/url they came from to return them, assuming through a post.login hook, to their original location.

Yes, you are right. Current logic to get landing page url is by getting list of sites that user belongs to and pick the first one. But for your requirement you might want to change the logic as per your needs based on current url.

Not sure but check PortalUtil method which will give you current url from HttpServletRequest if that helps.
PortalUtil.getCurrentURL(HttpServletRequest request)


Thanks,
Tejas
Craig Laidlaw, modificado hace 9 años.

RE: looking for custom landing page hook suggestions

New Member Mensajes: 5 Fecha de incorporación: 26/11/13 Mensajes recientes
Hi Tejas,
Thank you for weighing in. I tried the PortalUitl.getCurrentURL(request) and it returns the "/c" string from the login. That seems to be the return value for most all of the URL getters I have tried from the HttpServletRequest and PortalUtil objects. I even dropped in a PreLogin hook with the same results.

Nagendra, I read through the ServicePreAction.java code and tried a couple different PortalUtil methods (getPathContext, getPathFriendlyURLPublic, getPathMain) but again none returned to me the path I started the original login process from. I also tried grabbing the group id from the layout (which was null as I expected) and from the ParamUtil which resulted in 0.

I appreciate your suggestions.
Craig
thumbnail
Nagendra Kumar Busam, modificado hace 9 años.

R: looking for custom landing page hook suggestions

Liferay Master Mensajes: 678 Fecha de incorporación: 7/07/09 Mensajes recientes
If you are using custom theme, you can pass referer as parameter with sign in URL - hope it works

Sent from my iPhone with Liferay.com Forums
Craig Laidlaw, modificado hace 9 años.

RE: looking for custom landing page hook suggestions

New Member Mensajes: 5 Fecha de incorporación: 26/11/13 Mensajes recientes
This may not be the slickest approach but I have something working...

Instead of attaching the action to the login.events.post I moved it to the servlet.service.events.post area and check for the PortalUtil.getCurrentURL to contain "doActionAfterLogin".

I then parse the page out of the currentURL and set the WebKeys.LAST_PATH to that value.

Not the most efficient but we only use Liferay to supply content to our main web application so we can endure the overhead.

Thank you for your suggestions and input.
thumbnail
Nagendra Kumar Busam, modificado hace 9 años.

RE: looking for custom landing page hook suggestions

Liferay Master Mensajes: 678 Fecha de incorporación: 7/07/09 Mensajes recientes
We should be very careful with what we do with servlet.service.events.pre & servlet.service.events.post - the reason is it will be invoked for each & every resource call from browser (it's kind of overhead). Initially I thought of servlet.service.events.post, later dropped myself