public UriBuilder uriTemplate(String uriTemplate){
  Matcher match=uriPattern.matcher(uriTemplate);
  if (match.matches()) {
    scheme(match.group(1));
    String host=match.group(2);
    if (host != null) {
      int at=host.indexOf('@');
      if (at > -1) {
        String user=host.substring(0,at);
        host=host.substring(at + 1);
        userInfo(user);
      }
    }
    host(host);
    if (match.group(4) != null)     port(Integer.valueOf(match.group(4)));
    if (match.group(5) != null)     path(match.group(5));
    if (match.group(7) != null)     replaceQuery(match.group(7));
    if (match.group(9) != null)     fragment(match.group(9));
    return this;
  }
  match=sspPattern.matcher(uriTemplate);
  if (match.matches()) {
    scheme(match.group(1));
    schemeSpecificPart(match.group(2));
    return this;
  }
  match=pathPattern.matcher(uriTemplate);
  if (match.matches()) {
    if (match.group(1) != null)     path(match.group(1));
    if (match.group(3) != null)     replaceQuery(match.group(3));
    if (match.group(5) != null)     fragment(match.group(5));
    return this;
  }
  throw new RuntimeException("Illegal uri template: " + uriTemplate);
}

public UriBuilder uriTemplate ( String uriTemplate ) { Matcher match = uriPattern . matcher ( uriTemplate ) ; if ( match . matches ( ) ) { scheme ( match . group ( 1 ) ) ; String host = match . group ( 2 ) ; if ( host != null ) { int at = host . indexOf ( '@' ) ; if ( at > - 1 ) { String user = host . substring ( 0 , at ) ; host = host . substring ( at + 1 ) ; userInfo ( user ) ; } } host ( host ) ; if ( match . group ( 4 ) != null ) port ( Integer . valueOf ( match . group ( 4 ) ) ) ; if ( match . group ( 5 ) != null ) path ( match . group ( 5 ) ) ; if ( match . group ( 7 ) != null ) replaceQuery ( match . group ( 7 ) ) ; if ( match . group ( 9 ) != null ) fragment ( match . group ( 9 ) ) ; return this ; } match = sspPattern . matcher ( uriTemplate ) ; if ( match . matches ( ) ) { scheme ( match . group ( 1 ) ) ; schemeSpecificPart ( match . group ( 2 ) ) ; return this ; } match = pathPattern . matcher ( uriTemplate ) ; if ( match . matches ( ) ) { if ( match . group ( 1 ) != null ) path ( match . group ( 1 ) ) ; if ( match . group ( 3 ) != null ) replaceQuery ( match . group ( 3 ) ) ; if ( match . group ( 5 ) != null ) fragment ( match . group ( 5 ) ) ; return this ; } throw new RuntimeException ( "Illegal uri template: " + uriTemplate ) ; }
you may put path parameters anywhere within the uritemplate except port
