code: public static String getTemplatedURL( ServletContext servletContext,
                                            ServletRequest request, MutableURI uri,
                                            String key, URIContext uriContext )
      {
          TemplatedURLFormatter formatter = getTemplatedURLFormatter( request );
          if ( formatter == null )
          {
              formatter = TemplatedURLFormatter.getTemplatedURLFormatter( request );
              if ( formatter == null )
              {
                  return uri.getURIString( uriContext );
              }
          }
  
          return formatter.getTemplatedURL( servletContext, request, uri, key, uriContext );
      }
docs: Format the given URI using a URL template, if defined in the URL template
  config file, WEB-INF/url-template-config.xml. The {@link URIContext}
  encapsulates some additional data needed to write out the string form.
  E.g. It defines if the &quot;&amp;amp;&quot; entity or the
  '&amp;' character should be used to separate quary parameters.
  
  <p>First try to use ther per-request registered <code>TemplatedURLFormatter</code>.
  If one is not registered, try to use the per-webapp default
  <code>TemplatedURLFormatter</code>, defined in beehive-netui-config.xml
  (with a class name) and set as an attribute of the ServletContext. Otherwise,
  with no formatter, just return {@link MutableURI#getURIString(URIContext)}.
  
  @param servletContext the current ServletContext.
  @param request the current ServletRequest.
  @param uri the MutableURI to be formatted into a String.
  @param key the URL template type to use for formatting the URI
  @param uriContext data required to write out the string form.
  @return the URL as a <code>String</code>