留言板

How to make URL point to personal site?

Bill Liu,修改在10 年前。

How to make URL point to personal site?

New Member 帖子: 6 加入日期: 14-2-14 最近的帖子
I need a URL to point to a user's personal web page (equivalent on Liferay.com would be this, except instead of pointing to my profile page it would point to your personal profile page). In other words, I need a static (non-changing) URL where each time you hit it, you would be redirected to YOUR (the logged in user's) personal profile page.

I know how to get the URL to a user's profile page once I got the actual User object from ThemeDisplay. What I'm having problems with is the seemingly trivial task of pointing a static and friendly URL to some piece of Java code. I've tried several things which did not work.

1.) Create a custom servlet that maps to a static URL. In the doGet method of the servlet, it redirects to the person. The problem I faced with this approach was that I was unable to get the themeDisplay object from the HttpServletRequest object since I was outside the portal context. I've also tried:

1a.) Using the PortalDelegateServlet. I continued to have the same problem and was still not getting the themeDisplay object (the URL did hit my code so I'm assuming it wasn't a matter of setting it up correctly)

2.) Creating a struts action in a hook, then in a servlet create a friendly URL mapper to the action. An aside on the design of Liferay: maybe I'm missing something but why would struts actions that are tied to servlets be created in a hook? Maybe I messed up the configuration, but I could not get the friendly URL to hit my code. I also couldn't play with the unfriendly URL to hit my code. I'm guessing that the format of a struts action path goes something like <portlet-name>/<action>, and it is through the path that associates a struts action with a portlet. Is that incorrect?

3.) Using a portlet action (like the ones generated from the tag <portlet:actionURL name=<method name> ... etc). Unfortunately, the only phase you can set this is in the action phase, which Liferay appends p_p_auth parameters and doesn't allow another user to use the generated URL (which defeats the whole purpose).

Is there another way to do this? Did I mess up somewhere in one of my steps? Thanks in advance.
thumbnail
Zsigmond Rab,修改在10 年前。

RE: How to make URL point to personal site?

Liferay Master 帖子: 728 加入日期: 10-1-5 最近的帖子
Hi Bill,

I'm not sure, if I see your problem correctly. The url pointing to your "User Profile" is generated into your navigation dropdown after login.

What else do you need compare to that?

Regards,
Zsigmond