Attaching patches for this feature implemented in specialpurpose/cmssite component.
This patch is for implementation done to support the feature.
- Introduced 3 new fields in WebSite Entity
- hostedPathAlias - For WebSites hosted on webapp using the WebSiteFilter, indicates the path this WebSite will be hosted on
- isDefault - If Y then it is default WebSite
- displayMaintenancePage - If set to Y, redirect user to site maintenance page (When a specific website needs to brought down without interrupting any of the other processes on the same instance)
- Updates in RequestHandler for handling requests from MULTI_SITE_ENABLED web app and to append URLs with hostedPathAlias for the corresponding website.
- Removed webSiteEntry from cmssite webapp web.xml as now this app is going to be MULTI_SITE_ENABLED and will serve as a sample for multi-site environment, also updated ControlServlet mapping to /* from /cms/*.
- Added Filter and mapping for WebSiteFilter in web.xml.
- Updates in CmsEvents.cms event to handle case of showing maintenance page when a specific site has brought down.
- WebSiteFilter class for filtering requests for multi-site-enabled webapp having WebSiteFilter entry.
- Prepared class MultiSiteRequestWrapper and overridden getPathInfo() method of HttpServletRequest class which is used to hide the hostPathAlias portion of the URL from OFBiz.
This patch contains supporting data for demonstration of multi-site setup.
Made the existing website the default one, so that user lands here whenever no specific hostedPathAlias is supplied.
Introduced two more websites and added their URLs on default website home page for reference. Anyone can refer the setup to setup the similar environment in hot-deploy application.
Introduced the maintenance page content and associated it with all the 3 sites, but in custom setup, every website can have it’s own.
Any website can be brought down easily by setting up value of displayMaintenancePage to Y from here: https://localhost:8443/content/control/EditWebSite?webSiteId=WebSite2
Clean build with data load is required prior to testing the feature.
Here are the URLs for accessing these directly-
- CmsSite(Default) = https://localhost:8443/cmssite/
- WebSite-1 = https://localhost:8443/cmssite/website-1
- WebSite-2 = https://localhost:8443/cmssite/website-2
A developer can simply have cmssite component available in specialpurpose and do an entry of WebSiteFilter in hot-deploy webapp web.xml can leverage the feature and can setup a multi-site enabled webapp.
Thanks Scott Gray for the design and implementation, thanks Mohammed Rehan Khan for providing the patch for trunk.
Feedback from the community is welcome, please review and suggest any improvements you see.