code: public String format( boolean removeUnsetTokens )
      {
          // template should already have been parsed with a call to
          if ( !_isParsed )
          {
              // Parse the template into tokens and literals
              parseTemplate();
          }
  
          InternalStringBuilder result = new InternalStringBuilder( _template.length() + 16 );
          for ( java.util.Iterator ii = _parsedTemplate.iterator(); ii.hasNext(); )
          {
              TemplateItem item = ( TemplateItem ) ii.next();
              if ( item.isToken() )
              {
                  if ( _tokenValuesMap.containsKey( item.getValue() ) )
                  {
                      appendToResult( result, ( String ) _tokenValuesMap.get( item.getValue() ) );
                  }
                  else
                  {
                      // No value for the token.
                      if ( !removeUnsetTokens )
                      {
                          // treat the token as a literal
                          appendToResult( result, item.getValue() );
                      }
                  }
              }
              else
              {
                  appendToResult( result, item.getValue() );
              }
          }
  
          if ( result.length() > 0 && result.charAt( result.length() - 1 ) == '?' )
          {
              result.deleteCharAt( result.length() - 1 );
          }
  
          return result.toString();
      }
docs: Return the String representation of the URL after replacing
  the tokens in the template with their associated values.
  If the boolean argument is <code>true</code>, then the unset
  template tokens are removed. Otherwise, do not cleanup
  the unset tokens.
  
  @param removeUnsetTokens flag to tell URLTemplate to remove
  or leave the unset tokens in the URL.
  @return the url