To use ATG platform functionality, a Web application needs to start Nucleus by invoking NucleusServlet
. This servlet does not need to have any paths mapped to it, but must have the load-on-startup
flag set to 1 so that it runs before any other ATG component. The web.xml
file in atg_bootstrap.war
includes the following lines:
<servlet> <servlet-name>NucleusServlet</servlet-name> <servlet-class>atg.nucleus.servlet.NucleusServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
The NucleusServlet
creates an instance of Nucleus and sets it as an attribute of the web application. The Nucleus instance can be retrieved using the Nucleus.getGlobalNucleus()
method.
Note on servlet ordering: When you declare servlets in web.xml
, you can use optional load-on-startup
tags to determine the order in which the servlets are called. If you do not use these tags, the servlets are called in the order that they appear in web.xml
. Because NucleusServlet
must run first, its load-on-startup
value must be 1, as in the example above.