Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Virtual hosting Communities
This is a split from this topic with a more meaningful subject...
I've got the first version of this completed, and a patch submitted to JIRA (LEP-1284)
Feedback is welcome. So far, its perfect for my needs (of course it is - I wrote it!
)
I've got the first version of this completed, and a patch submitted to JIRA (LEP-1284)
Feedback is welcome. So far, its perfect for my needs (of course it is - I wrote it!
sounds like something i need also. will be checking it out.
thanks Joel.
thanks Joel.
11365, modificat fa 19 anys.
Liferay Master
Apunts: 846
Data d'incorporació: 05/08/04
Publicacions recents
Awesome Joel. Testing it out now...
The patch has been applied by the Liferay team (and modified slightly) to the main source code trunk and is in Subversion now. Get the latested source from Subversion rather than using my patch.
I just checked out the code (replacing my version with what is now "official"), and my quick tests show everything works as expected. A few comments:
Control of activation of the feature has been moved to /portal/portal-ejb/classes/system.properties vs. the old portal.properties file. The option is now named com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter. I was unaware of the "system.properties" file, but that is a better place for it.
Note that the default setting for this is "true", so you only have to do something to turn it OFF. I had "false" in mine because activating it can potentially cost you one database hit per query. In reality, the Hibernate caching mechanism will probably eliminate most if not all of those, but if your not using virtual hosting at all, it doesn't hurt to turn off.
My original patch mentioned an option to turn on and off the portal's default use of the "short form" of the URL (e.g. whether or not you wanted menu options to use the www.virtualdomain.com/page1 version (the "short form"), or the www.virtualdomain.com/web/community_x/page1 version (the "long form"). That option has been removed, and the system will always generate the short form.
I can't argue with the decision. I was unsure of people's desire to use the long or short form (though I will most certainly want to use the short form). Note that this option does NOT affect legacy URLs - the "long form" will always be accepted by the server and processed correctly.
Bottom line: if you want to use the feature, get the latest build. That's all - everything will work without the need to customize any settings.
Thanks to the Liferay team for getting this patch applied so quickly!
I just checked out the code (replacing my version with what is now "official"), and my quick tests show everything works as expected. A few comments:
Control of activation of the feature has been moved to /portal/portal-ejb/classes/system.properties vs. the old portal.properties file. The option is now named com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter. I was unaware of the "system.properties" file, but that is a better place for it.
Note that the default setting for this is "true", so you only have to do something to turn it OFF. I had "false" in mine because activating it can potentially cost you one database hit per query. In reality, the Hibernate caching mechanism will probably eliminate most if not all of those, but if your not using virtual hosting at all, it doesn't hurt to turn off.
My original patch mentioned an option to turn on and off the portal's default use of the "short form" of the URL (e.g. whether or not you wanted menu options to use the www.virtualdomain.com/page1 version (the "short form"), or the www.virtualdomain.com/web/community_x/page1 version (the "long form"). That option has been removed, and the system will always generate the short form.
I can't argue with the decision. I was unsure of people's desire to use the long or short form (though I will most certainly want to use the short form). Note that this option does NOT affect legacy URLs - the "long form" will always be accepted by the server and processed correctly.
Bottom line: if you want to use the feature, get the latest build. That's all - everything will work without the need to customize any settings.
Thanks to the Liferay team for getting this patch applied so quickly!
Well, I found a rather amusing (but at the moment, annoying) bug in the new virtual hosting system that I'm not sure was there before (but I can't be sure).
For some reason, you can not use a friendly URL that contains the letter "c" in it! If you try to save a URL that has "c" anywhere in it, the system complains with "Please use a URL that does not conflict with the keyword "c". Worse, if any friendly URLs existed prior to switching to the virtual host system, those links are no longer accessible!
I'm looking for the issue now, but if any of you guys have any hints, I could use the help!
For some reason, you can not use a friendly URL that contains the letter "c" in it! If you try to save a URL that has "c" anywhere in it, the system complains with "Please use a URL that does not conflict with the keyword "c". Worse, if any friendly URLs existed prior to switching to the virtual host system, those links are no longer accessible!
I'm looking for the issue now, but if any of you guys have any hints, I could use the help!
25541, modificat fa 19 anys.
New Member
Apunts: 5
Data d'incorporació: 15/08/06
Publicacions recents
my $.02:
I am guessing. Maybe the system interpret "c" as a keyword as the context "/c". If that is the case, you might need to change that interpretation.
I am guessing. Maybe the system interpret "c" as a keyword as the context "/c". If that is the case, you might need to change that interpretation.
Well, I found it. This was added to the VirtualHostFilter:
So, it seems to be related to the layout.friendly.url.keywords setting.
I can see (sort of) the desire to prevent the key words from being used "as is", but the line
imples that if the URL contains the keyword, then it is invalid. Well, "c", being a keyword, qualifies.
I'm going to change it so the keyword has to be at least two characters before the "contains" rule is applied. Any complaints?
private boolean _isValidFriendlyURL(String friendlyURL) {
String[] keywords = PropsUtil.getArray(
PropsUtil.LAYOUT_FRIENDLY_URL_KEYWORDS);
for (int i = 0; i < keywords.length; i++) {
if ((LayoutFriendlyURLException.validate(friendlyURL) > -1) ||
(friendlyURL.indexOf(keywords[i]) != -1)) {
return false;
}
}
return true;
}
So, it seems to be related to the layout.friendly.url.keywords setting.
I can see (sort of) the desire to prevent the key words from being used "as is", but the line
friendlyURL.indexOf(keywords[i]) != -1))
imples that if the URL contains the keyword, then it is invalid. Well, "c", being a keyword, qualifies.
I'm going to change it so the keyword has to be at least two characters before the "contains" rule is applied. Any complaints?
What version of the code will have this feature?
I am downloading the Liferay Portal Enterprise EAR.
Thanks,
Chad.
I am downloading the Liferay Portal Enterprise EAR.
Thanks,
Chad.
11365, modificat fa 19 anys.
Liferay Master
Apunts: 846
Data d'incorporació: 05/08/04
Publicacions recents
It's not in a released version. You have to grab the trunk from SVN.
Another thing we did was upgrade the the portal to servlet 2.4. This allows us to control whether rd.include or rd.forward will trigger the filter chain.
This will allow us to start developing a liferay url rewrite filter so we can get around the restricted paths -- among other things that this can open up for us.
Another thing we did was upgrade the the portal to servlet 2.4. This allows us to control whether rd.include or rd.forward will trigger the filter chain.
This will allow us to start developing a liferay url rewrite filter so we can get around the restricted paths -- among other things that this can open up for us.
25541, modificat fa 19 anys.
New Member
Apunts: 5
Data d'incorporació: 15/08/06
Publicacions recents
Michael:
When will be the next release? Will it be 4.2?
Thanks,
Sue
When will be the next release? Will it be 4.2?
Thanks,
Sue
11365, modificat fa 19 anys.
Liferay Master
Apunts: 846
Data d'incorporació: 05/08/04
Publicacions recents
looking like the late nov timeframe
Community
Company
Feedback