Installation

Webpagebytes CMS runs inside a servlet container like Tomcat, Jetty or GlashFish that supports Servlet API 2.5 or higher.

Take the following steps to integrate Webpagebytes CMS in a web application
1) Download Webpagebytes CMS library
2) Configure the administration servlet
3) Configure the public content servlet
4) Configure the Webpagebyes CMS plugins

Download Webpagebytes CMS library

Download the library from the Download page.

Configure the administration servlet

The administration servlet offers a web interface to add and edit the CMS content. Below is an example of a web.xml fragment to configure the administration interface servlet.

<servlet>
    <servlet-name>admin</servlet-name>
    <servlet-class>com.webpagebytes.cms.WPBAdminServlet</servlet-class>
    <init-param>
        <param-name>admin-uri-prefix</param-name>
        <param-value>/admin</param-value>
    </init-param>        
</servlet>
<servlet-mapping>
    <servlet-name>admin</servlet-name>
    <url-pattern>/admin/*</url-pattern>
</servlet-mapping>

In the above example the admin servlet name is mapped with urls that start with /admin/, this means all admin requests will be processed by com.webpagebytes.cms.WPBAdminServlet servlet.
WPBAdminServlet servlet contains the implementation for the web interface that creates and edits the CMS content.

Two examples are provided below to explain the admin-uri-prefix parameter value.

The first example assumes that the web application is deployed on http://yourdomain in the ROOT context path, and the admin web interface should be available at http://yourdomain/youradmin/
In this case the admin-uri-prefix value is /youradmin because the root context path is the empty string.

The second example assumes that the web application is deployed on http://yourdomain in the context1 context path, and the admin web interface should be available at http://yourdomain/context1/youradmin/
In this case the admin-uri-prefix value is /context1/youradmin

Configure the public content servlet

The public content servlet delivers the content that is public to the web application users.
Below is an example of a web.xml fragment to configure the public content servlet.

<servlet>
	<servlet-name>public</servlet-name>
	<servlet-class>com.webpagebytes.cms.WPBPublicContentServlet</servlet-class>
</servlet>	
<servlet-mapping>
	<servlet-name>public</servlet-name>
	<url-pattern>/*</url-pattern>
</servlet-mapping>

In the above example the public servlet is mapped with the root / path, this means that all public requests will be processed by the com.webpagebytes.cms.WPBPublicContentServlet servlet.
WPBPublicContentServlet servlet contains the implementation to deliver the public content of the CMS.

In the above example the Webpagebytes CMS is deployed in the ROOT context path and the public content will be accessible to http://yourdomain/

If the web application containing Webpagebytes CMS is deployed in another context path (for example 'demo') then the public content will be accessible to http://yourdomain/demo/

Configure the Webpagebytes CMS plugins

Webpagebytes CMS requires a configuration xml file that contains the CMS configuration elements. The CMS engine will get the configuration xml file path from a servlet context parameter named wpbConfigurationPath. For details and example of the wpbConfigurationPath please see CMS customization.

It is recommanded for this xml configuration to not be included in the web application folder (or in the .war file), but to be external, so that the application deploy artefact to be the same for all environments (dev, QA, staging, production) and only the XML configuration to be different on these environments.

The first example considers a standard Tomcat deployment with a web application deployed in the /demo context path.
The context wpbConfigurationPath parameter can be defined in following xml path: CATALINA_HOME/conf/Catalina/localhost/demo.xml
The content of demo.xml is below (this assumes that the web application is deployed into /demo context path and the Webpagebytes CMS configuration xml file is located at /usr/share/tomcat7/conf/wpbConfiguration.xml

<Context>
    <Parameter 
        name="wpbConfigurationPath" 
        value="/usr/share/tomcat7/conf/wpbConfiguration.xml" override="false"
    />
</Context>

The second example considers a Jetty deployment and a web application deployed in the /demo context path. The example assumes that Jetty is deployed into /usr/share/jetty/
The following /usr/share/jetty/webapps/demo.xml configures the context wpbConfigurationPath parameter (assuming that the Webpagebytes CMS configuration xml file is located at /usr/share/jetty/demo/wpbConfiguration.xml)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
	<Set name="contextPath">/demo</Set>
	<Set name="war"><Property name="jetty.webapps" default="." />/demo.war</Set>

	<Call name="setInitParameter">
		<Arg>wpbConfigurationPath</Arg>
		<Arg>/usr/share/jetty/demo/wpbConfiguration.xml</Arg>
	</Call>
</Configure>
Fork me on GitHub