static URI convertStringToURI(String baseAddress) { try { return URI.create(baseAddress); } catch (RuntimeException ex) { // no need to check "https" scheme or indeed ':' // as the relative address will not work as the base address if (baseAddress.startsWith(HTTP_SCHEME)) { return new UriBuilderImpl().uriAsTemplate(baseAddress).build(); } throw ex; } }
static URI convertStringToURI(String baseAddress) { try { return URI.create(baseAddress); } catch (RuntimeException ex) { // no need to check "https" scheme or indeed ':' // as the relative address will not work as the base address if (baseAddress.startsWith(HTTP_SCHEME)) { return new UriBuilderImpl().uriAsTemplate(baseAddress).build(); } throw ex; } }
static URI convertStringToURI(String baseAddress) { try { return URI.create(baseAddress); } catch (RuntimeException ex) { // no need to check "https" scheme or indeed ':' // as the relative address will not work as the base address if (baseAddress.startsWith(HTTP_SCHEME)) { return new UriBuilderImpl().uriAsTemplate(baseAddress).build(); } else { throw ex; } } }
public UriBuilder uri(String uriTemplate) throws IllegalArgumentException { if (StringUtils.isEmpty(uriTemplate)) { throw new IllegalArgumentException(); } try { return uri(URI.create(uriTemplate)); } catch (Exception ex) { if (URITemplate.createExactTemplate(uriTemplate).getVariables().isEmpty()) { throw new IllegalArgumentException(ex); } return uriAsTemplate(uriTemplate); } }
} catch (IllegalArgumentException ex) { if (!URITemplate.createExactTemplate(path).getVariables().isEmpty()) { return uriAsTemplate(path);