code: public static URLTemplatesFactory getURLTemplatesFactory(ServletRequest servletRequest)
      {
          assert servletRequest != null : "The ServletRequest cannot be null.";
  
          if (servletRequest == null) {
              throw new IllegalArgumentException("The ServletRequest cannot be null.");
          }
  
          return (URLTemplatesFactory) servletRequest.getAttribute(URL_TEMPLATE_FACTORY_ATTR);
      }
docs: Gets the URLTemplatesFactory instance from a ServletRequest attribute.
  
  @param servletRequest the current ServletRequest.
  @return the URLTemplatesFactory instance from the ServletRequest.