code: private static void initURLTemplates( ServletContext servletContext )
      {
          TemplatedURLFormatter formatter = TemplatedURLFormatter.getTemplatedURLFormatter( servletContext );
          if ( formatter == null )
          {
              // get the default template formatter class name from the config file
              formatter = getTemplatedURLFormatter();
  
              assert formatter != null : "Found a non-null URL formatter";
  
              // set the TemplatedURLFormatter attribute on the context.
              TemplatedURLFormatter.initServletContext( servletContext, formatter );
          }
  
          URLTemplatesFactory templatesFactory = URLTemplatesFactory.getURLTemplatesFactory( servletContext );
          if ( templatesFactory == null )
          {
              // URLTemplatesFactory has not been initialized,
              // get a URLTemplatesFactory object from the containerAdapter.
              templatesFactory = PageFlowUtils.createURLTemplatesFactory( servletContext );
  
              // get the known/req tokens from the default formatter for the factory to use to verify templates
              templatesFactory.setKnownTokens( formatter.getKnownTokens() );
              templatesFactory.setRequiredTokens( formatter.getRequiredTokens() );
              templatesFactory.load( servletContext );
  
              // set the URLTemplatesFactory attribute on the context.
              URLTemplatesFactory.initServletContext( servletContext, templatesFactory );
          }
      }
docs: Creates a URLTemplatesFactory (may be container specific from the
  ServletContainerAdapter) and the the default TemplatedURLFormatter
  (registered in the netui config). These classes are used by the
  URLRewriterService.