10.1

Deploying QXPSM in a shared Spring context
In this type of deployment, QuarkXPress Server Manager can be embedded in a Spring
application and can share the same Spring container instance and Spring context. This
deployment model also allows the consuming of QuarkXPress Server Manager services
(RequestService and AdminService) as POJOs (plain old Java objects).
This type of deployment model is possible only when the application in which QuarkXPress
Server Manager is to be embedded is a Spring application and is deployed with an embedded
or external Tomcat Web container.
To install QuarkXPress Server Manager in a shared Spring context:
1
Copy the qxpsm and qxpsmadmin Web application to the webapps folder for your existing
application, so that QuarkXPress Server Manager can be recognized as a Web application
in the existing Web container.
Set cacheFolderContextFile to the path of the "cache.xml" file relative to the current
working directory.
Set serverXmlFilePath to the path of the "Server.xml" file relative to the current working
directory.
2
Copy all QXPSM-dependent jar files from [QXPSM_Home]/Server/dependencies and
[QXPSM_Home]/Server/lib to a common location, then add all of these jar files to the
application classpath so that they are available to other Web applications that want to use
the QuarkXPress Server Manager API locally.
3
Import the QuarkXPress Server Manager Spring context file, "ManagerContainerConfig.xml,"
into the existing application Spring context.
4
Create a Java class named CustomContextLoaderListener that extends
org.springframework.web.context.ContextLoaderListener. Override the method
loadParentContext() as shown here:
public class CustomContextLoaderListener extends
org.springframework.web.context.ContextLoaderListener {
private static final Logger logger =
Logger.getLogger(GlobalContextLoaderListener.class);
public void contextInitialized(ServletContextEvent servletContextEvent) {
super.contextInitialized(servletContextEvent);
String contextName =
servletContextEvent.getServletContext().getServletContextName();
}
protected ContextLoader createContextLoader() {
return new CustomContextLoader();
}
class CustomContextLoader extends ContextLoader {
protected ApplicationContext loadParentContext(ServletContext servletContext)
{
//=============================================================
//Here, return the spring context to be used as parent context
//=============================================================
return com.xyz.myapplication.MyApplicationContext.getContext();
}
protected WebApplicationContext createWebApplicationContext(
ServletContext servletContext, ApplicationContext parent) {
return super.createWebApplicationContext(servletContext, parent);
12 | QUARKXPRESS SERVER 10.1 README
DEPLOYING QUARKXPRESS SERVER MANAGER