Please help me in below problem
I have single liferay instance and it has single site on it. This single site is serving multiple clients and they access the site using their dedicated domain name
xxx.mysite.com -> domain name for the client xxx yyy.mysite.com -> domain name for the client yyy
These domain names are configured in apache web server which is sitting infront of liferay instance. I used property in portal-ext.properties web.server.host to configure the webserver information in liferay. Liferay uses this property to generate all the links on the page(if this property is not mentioned it uses the servername to generate the urls). But using this I can only define one site at a time. I can not achieve above functionality. I went to the liferay code and in PortalImpl.java it has following code
public String getPortalURL(
String serverName, int serverPort, boolean secure) {
StringBundler sb = new StringBundler();
if (secure || Http.HTTPS.equals(PropsValues.WEB_SERVER_PROTOCOL)) {
sb.append(Http.HTTPS_WITH_SLASH);
}
else {
sb.append(Http.HTTP_WITH_SLASH);
}
if (Validator.isNull(PropsValues.WEB_SERVER_HOST)) {
sb.append(serverName);
}
else {
sb.append(PropsValues.WEB_SERVER_HOST);
}
if (!secure) {
if (PropsValues.WEB_SERVER_HTTP_PORT == -1) {
if ((serverPort != Http.HTTP_PORT) &&
(serverPort != Http.HTTPS_PORT)) {
sb.append(StringPool.COLON);
sb.append(serverPort);
}
}
else {
if (PropsValues.WEB_SERVER_HTTP_PORT != Http.HTTP_PORT) {
sb.append(StringPool.COLON);
sb.append(PropsValues.WEB_SERVER_HTTP_PORT);
}
}
}
if (secure) {
if (PropsValues.WEB_SERVER_HTTPS_PORT == -1) {
if ((serverPort != Http.HTTP_PORT) &&
(serverPort != Http.HTTPS_PORT)) {
sb.append(StringPool.COLON);
sb.append(serverPort);
}
}
else {
if (PropsValues.WEB_SERVER_HTTPS_PORT != Http.HTTPS_PORT) {
sb.append(StringPool.COLON);
sb.append(PropsValues.WEB_SERVER_HTTPS_PORT);
}
}
}
return sb.toString();
}
In above method it uses the web.server.host property defined in poratal-ext.properties and constructs the URLs. Now I need to overwrite this method to determine the web server host during runtime.
my question are. How to overwrite this function in PoralImpl.java? Do I need use extension to achieve this? Is anyother way(betterway) to achieve this functionality.
I am using liferay 6.1.0 GA-1/tomcat bundle