public static Map parseParamters(URI uri) throws URISyntaxException { return uri.getQuery() == null ? Collections.EMPTY_MAP : parseQuery(stripPrefix(uri.getQuery(), "?")); }
/** * <p> * Creates a URI from the original URI and the remaining paramaters. * </p> * * @param originalURI the original URI to populate. * @param params the params map to add in the URI. * @return the populated URI. */ public static URI createRemainingURI(URI originalURI, Map params) throws URISyntaxException { String s = createQueryString(params); if (s.length() == 0) { s = null; } return createURIWithQuery(originalURI, s); }
protected Endpoint getResolvedEPR(ServiceEndpoint ep) throws Exception { FtpSenderEndpoint ftpEndpoint = new FtpSenderEndpoint(this, ep); URI uri = new URI(ep.getEndpointName()); Map map = URISupport.parseQuery(uri.getQuery()); IntrospectionSupport.setProperties(ftpEndpoint, map); ftpEndpoint.setUri(uri); ftpEndpoint.validate(); return ftpEndpoint; }
protected Endpoint getResolvedEPR(ServiceEndpoint ep) throws Exception { // We receive an exchange for an EPR that has not been used yet. // Register a provider endpoint and restart processing. JmsEndpoint jmsEp = new JmsEndpoint(true); jmsEp.setServiceUnit(new DefaultServiceUnit(component)); jmsEp.setService(ep.getServiceName()); jmsEp.setEndpoint(ep.getEndpointName()); jmsEp.setRole(MessageExchange.Role.PROVIDER); URI uri = new URI(ep.getEndpointName()); Map map = URISupport.parseQuery(uri.getQuery()); if (IntrospectionSupport.setProperties(jmsEp, map, "jms.")) { uri = URISupport.createRemainingURI(uri, map); } if (uri.getPath() != null) { String path = uri.getSchemeSpecificPart(); while (path.startsWith("/")) { path = path.substring(1); } if (path.startsWith(AbstractJmsProcessor.STYLE_QUEUE + "/")) { jmsEp.setDestinationStyle(AbstractJmsProcessor.STYLE_QUEUE); jmsEp.setJmsProviderDestinationName(path.substring(AbstractJmsProcessor.STYLE_QUEUE.length() + 1)); } else if (path.startsWith(AbstractJmsProcessor.STYLE_TOPIC + "/")) { jmsEp.setDestinationStyle(AbstractJmsProcessor.STYLE_TOPIC); jmsEp.setJmsProviderDestinationName(path.substring(AbstractJmsProcessor.STYLE_TOPIC.length() + 1)); } } return jmsEp; }
String params; if (!checkParenthesis(ssp)) { throw new URISyntaxException(uri.toString(), "Not a matching number of '(' and ')' parenthesis"); String components[] = splitComponents(componentString); rc.components = new URI[components.length]; for (int i = 0; i < components.length; i++) { if (p >= 0) { if (p > 0) { rc.path = stripPrefix(params.substring(0, p), "/"); rc.parameters = parseQuery(params.substring(p + 1)); } else { if (params.length() > 0) { rc.path = stripPrefix(params, "/");
/** * <p> * Removes any URI query from the given URI. * </p> * * @param uri the given URI. * @return a clean URI with removed any URI query. */ public static URI removeQuery(URI uri) throws URISyntaxException { return createURIWithQuery(uri, null); }
sb.append(createQueryString(parameters));
Map map = URISupport.parseQuery(uri.getQuery()); IntrospectionSupport.setProperties(fileEp, map);
protected Endpoint getResolvedEPR(ServiceEndpoint ep) throws Exception { // We receive an exchange for an EPR that has not been used yet. // Register a provider endpoint and restart processing. HttpEndpoint httpEp = new HttpEndpoint(true); httpEp.setServiceUnit(new DefaultServiceUnit(component)); httpEp.setService(ep.getServiceName()); httpEp.setEndpoint(ep.getEndpointName()); httpEp.setRole(MessageExchange.Role.PROVIDER); URI uri = new URI(ep.getEndpointName()); Map map = URISupport.parseQuery(uri.getQuery()); if (IntrospectionSupport.setProperties(httpEp, map, "http.")) { uri = URISupport.createRemainingURI(uri, map); } if (httpEp.getLocationURI() == null) { httpEp.setLocationURI(uri.toString()); } return httpEp; }
@SuppressWarnings("unchecked") public CamelProviderEndpoint createEndpoint(String uriString, JbiComponent jbiComponent) throws URISyntaxException { URI uri = new URI(uriString); Map map = URISupport.parseQuery(uri.getQuery()); String camelUri = uri.getSchemeSpecificPart(); Endpoint camelEndpoint = jbiComponent.getCamelContext().getEndpoint(camelUri); AsyncProcessor processor = jbiComponent.createCamelProcessor(camelEndpoint); CamelProviderEndpoint endpoint = new CamelProviderEndpoint(getServiceUnit(), camelEndpoint, jbiComponent.createBinding(camelEndpoint), processor); IntrospectionSupport.setProperties(endpoint, map); return endpoint; }
protected Endpoint getResolvedEPR(ServiceEndpoint ep) throws Exception { // We receive an exchange for an EPR that has not been used yet. // Register a provider endpoint and restart processing. BeanEndpoint endpoint = new BeanEndpoint(this, ep); // TODO //endpoint.setRole(MessageExchange.Role.PROVIDER); // lets use a URL to parse the path URI uri = new URI(ep.getEndpointName()); String beanName = null; // lets try the host first for hierarchial URIs if (uri.getHost() != null) { // it must start bean://host/path beanName = uri.getHost(); } else { // it must be an absolute URI of the form bean:name beanName = uri.getSchemeSpecificPart(); } if (beanName != null) { endpoint.setBeanName(beanName); } else { throw new IllegalArgumentException("No bean name defined for URI: " + uri + ". Please use a URI of bean:name or bean://name?property=value"); } Map map = URISupport.parseQuery(uri.getQuery()); if (endpoint.getBean() == null) { endpoint.setBean(endpoint.createBean()); } IntrospectionSupport.setProperties(endpoint.getBean(), map); return endpoint; }