In LifeRay we can found different types of urls, such as /c, /d, /theme, etc. It would be useful that all urls began by the same string, for example /portal. In that case we´ll have:
/portal/c../
/portal/d../
/portal/theme../
This allows Apache to handle easily the Liferay urls. To do that:
1.- Firstly, shutdown LifeRay.
2.- Edit portal-ext.properties, and add:
portal.ctx=/portal
portlet.virtual.path=/portal
3.- Rename the /ROOT folder to /portal in TOMCAT_HOME/webapps.
4.- Rename "tomcat-6.0.18/conf/Catalina/localhost/ROOT.xml" to "tomcat-6.0.18/conf/Catalina/localhost/portal.xml".
5.- Delete the content of the folders /temp and /work in TOMCAT_HOME (delete the tomcat cache).
6.- Restart LifeRay.
Probably we must redo the Lucene Index in LifeRay control panel. Finally we can go to the LifeRay home page at:
http://localhost/portal
Wellcome!
In Cms Howto you'll find updated tutorials to work with Alfresco, Liferay, and other cms software. In a world without information, Cms Howto is the solution.
Tuesday, November 17, 2009
Subscribe to:
Post Comments (Atom)
This does not work.
ReplyDeleteFirst, portlet.virtual.path and theme.virtual path are practically useless. They have to point directly to the theme or portlet war - so you can't have more than one portlet or theme war for this to work.
However, liferay-look-and-feel.xml supports a virtual-path element. Since it is in the theme war you can use it to specify the context path for your theme. If you are running under JBoss you would also need to specify the context path in jboss-web.xml.
Portlets also support a virtual-path element in liferay-portlet.xml. You have to go into each and every portlet to specify the context path for the portlet war. Again, you have to also specify the context path in jboss-web.xml.
Even after all that it probably still won't work correctly. Your first instinct was to probably code request.getContextPath(). That will always return the display name specified in web.xml, which is unfortunately correct as that is what the portlet spec says it is supposed to do. Instead, for the theme you need to get the various paths from the ThemeDisplay. For portlets, you actually have to get ahold of the portlet object and call its getContextPath method. Getting a valid reference to a portlet object can be tricky. On render requests it may be available as a request attribute. In my tests it is not on serveResource requests (AJAX calls). On those you have to get the portlet id (a request attribute) and then call PortletLocalServiceUtil.getPortletById().
To make this even more fun, in my environment we require that the context path root be dynamically changeable via an environment variable. I got this to work by using StrSubstitutor to process liferay-look-and-feel.xml and liferay-portlet.xml as the files are read to replace variables in the xml files. I can provide the code to do that if anyone needs it.
Have you tried?
ReplyDeleteBecause i have some portals running well, and using multiple themes and portlets.
Please, try it and tell me.
I'm a little bit confused.
ReplyDeleteHave same need because of using reverse proxy and wanted to set rules for only one url.
What is the way to achieve this: Changing LifeRay Context by using portlet.virtual.path and theme.virtual.path or by setting virtual-path in theme (and/or portlet) ?
Do we need to change contextPath in the theme xml deployment descriptor too ?
Hi papillon,
ReplyDeleteYou have to:
1- Change portal.ctx and portlet.virtual.path.
2- Rename Root folder
3- Rename Root.xml
Try it in a test enviroment ant tell me.
>Do we need to change contextPath in the theme xml deployment descriptor too ?
- No
Greetings