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