Configuring the Jaxcent servlet on a Java Servlet Container/Application Server

The Jaxcent servlet needs to be available at the URL pattern
    /servlet/JaxcentServlet21
(unless the jaxcent21.js file is modified.)

The compiled code for the servlet is available in JaxcentFramework21.jar and Jaxcent21.jar. These jar files need to be put in the classpath for your servlet container (also known as Java application server.) The steps for this would vary depending upon the servlet container. In Tomcat, you can do this by copying these files to the lib folder.

The servlet needs to be configured in the web.xml file. The parameters are as follows:
url-pattern/servlet/JaxcentServlet21/*
servlet-classjaxcentServlet.JaxcentServlet

In addition, you need to provide some init-parameters, as follows:

JaxcentConfigXML Path to a config XML file, which will contain the path mappings for Jaxcent. Similar to the servlet mappings, Jaxcent maps URLs to Java classes that it then loads, to process those URLs. This parameter is required.
ReloadableClasses Classpath for Jaxcent. The classes you write for Jaxcent, will be loaded from this classpath. You can also provide these classes to the application server, but during development it is recommended that you give the classes to Jaxcent directly. Jaxcent will reload these classes whenever they change. If you reload them using the application server, the context may get reloaded, which will break any existing Jaxcent connections. If Jaxcent does the reloading, existing web pages will continue using the old code, but when the page gets loaded again or refreshed, the new code will be used. This paramter is not required, but is recommended.

A sample portion of a web.xml file containing a Jaxcent servlet configuration is shown below.

  <servlet>
    <servlet-name>JaxcentServlet</servlet-name>
    <servlet-class>jaxcentServlet.JaxcentServlet</servlet-class>
    <init-param>
      <param-name>JaxcentConfigXML</param-name>
      <param-value>C:\Jaxcent\samples\JaxcentSampleConfig.xml</param-value>
    </init-param>
    <init-param>
      <param-name>ReloadableClasses</param-name>
      <param-value>C:\Jaxcent\samples</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>JaxcentServlet</servlet-name>
    <url-pattern>/servlet/JaxcentServlet21/*</url-pattern>
  </servlet-mapping>
When the servlet is correctly configured, visit the URL http://localhost/servlet/JaxcentServlet21 (changing the domain name as appropriate) in a browser, to make sure the servlet is working as expected.

Multiple instances of Jaxcent can be configured by specifying multiple servlets. In this case, the jaxcent21.js file will need to be unique for each servlet. The jaxcent21.js file corresponding to each servlet will need to be modified to specify the servlet URL.