/** * Constructs a {@link URL} from an <code>uri</code> and an optional * <code>query</code> string. The encoding strategy follow those of the * Camel HTTP component. * * @param uri * must be encoded with * {@link UnsafeUriCharactersEncoder#encode(String)}. * @param query * decoded query string. Replaces the query part of * <code>uri</code> if not <code>null</code>. */ static URL getEndpointUrl(String uri, String query) throws Exception { Map<String, Object> parameters = null; URI uriObj = new URI(uri); if (query == null) { parameters = URISupport.parseParameters(uriObj); } else { parameters = URISupport.parseQuery(query, false, true); } if (uriObj.getScheme().equals(GHTTPS_SCHEME)) { uriObj = new URI(HTTPS_SCHEME + ":" + uriObj.getRawSchemeSpecificPart()); } else { // ghttp or anything else uriObj = new URI(HTTP_SCHEME + ":" + uriObj.getRawSchemeSpecificPart()); } return URISupport.createRemainingURI(uriObj, parameters).toURL(); }
@Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { URI uriHttpUriAddress = new URI(UnsafeUriCharactersEncoder.encodeHttpURI(remaining)); URI endpointUri = URISupport.createRemainingURI(uriHttpUriAddress, parameters); URI httpUri = URISupport.createRemainingURI( new URI(uriHttpUriAddress.getScheme(), uriHttpUriAddress.getUserInfo(),
HttpClientConfigurer configurer = createHttpClientConfigurer(parameters, authMethods); addressUri = UnsafeUriCharactersEncoder.encodeHttpURI(addressUri); URI endpointUri = URISupport.createRemainingURI(new URI(addressUri), httpClientParameters); URI httpUri = URISupport.createRemainingURI(new URI(addressUri), parameters);
String addressUri = URISupport.createRemainingURI(u, parameters).toString();
URI httpUri = URISupport.createRemainingURI(new URI(UnsafeUriCharactersEncoder.encodeHttpURI(uri)), parameters);