当前位置: 首页>>代码示例>>Java>>正文


Java UriInfo类代码示例

本文整理汇总了Java中org.springframework.cloud.util.UriInfo的典型用法代码示例。如果您正苦于以下问题:Java UriInfo类的具体用法?Java UriInfo怎么用?Java UriInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UriInfo类属于org.springframework.cloud.util包,在下文中一共展示了UriInfo类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateAndCleanUriInfo

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
@Override
protected UriInfo validateAndCleanUriInfo(UriInfo uriInfo) {
	if (uriInfo.getScheme() == null) {
		throw new IllegalArgumentException("Missing scheme in amqp URI: " + uriInfo);
	}

	if (uriInfo.getHost() == null) {
		throw new IllegalArgumentException("Missing authority in amqp URI: " + uriInfo);
	}

	if (uriInfo.getUserName() == null || uriInfo.getPassword() == null) {
		throw new IllegalArgumentException("Missing userinfo in amqp URI: " + uriInfo);
	}

	String path = uriInfo.getPath();
	if (path == null) {
		//NO-OP, this is the default vhost
	} else {
		// Check that the path only has a single segment.  As we have an authority component
		// in the URI, paths always begin with a slash.
		if (path.indexOf('/') != -1) {
			throw new IllegalArgumentException("Multiple segments in path of amqp URI: " + uriInfo);
		}
	}
	return uriInfo;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-lattice,代码行数:27,代码来源:AmqpServiceInfoCreator.java

示例2: validateAndCleanUriInfo

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
@Override
protected UriInfo validateAndCleanUriInfo(UriInfo uriInfo) {
	if (uriInfo.getScheme() == null) {
		throw new IllegalArgumentException("Missing scheme in amqp URI: " + uriInfo);
	}

	if (uriInfo.getHost() == null) {
		throw new IllegalArgumentException("Missing authority in amqp URI: " + uriInfo);
	}

	if (uriInfo.getUserName() == null || uriInfo.getPassword() == null) {
		throw new IllegalArgumentException("Missing userinfo in amqp URI: " + uriInfo);
	}

	String path = uriInfo.getPath();
	if (path != null) {
		// Check that the path only has a single segment.  As we have an authority component
		// in the URI, paths always begin with a slash.
		if (path.indexOf('/') != -1) {
			throw new IllegalArgumentException("Multiple segments in path of amqp URI: " + uriInfo);
		}
	}

	return uriInfo;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:26,代码来源:AmqpServiceInfo.java

示例3: createServiceInfo

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
public SmtpServiceInfo createServiceInfo(Map<String, Object> serviceData) {
	String id = getId(serviceData);

	Map<String, Object> credentials = getCredentials(serviceData);

	String uri = getUriFromCredentials(credentials);

	if (uri == null) {
		String host = getStringFromCredentials(credentials, "host", "hostname");

		int port = getIntFromCredentials(credentials, "port");
		if (port == -1) {
			port = DEFAULT_SMTP_PORT;
		}

		String username = getStringFromCredentials(credentials, "user", "username");
		String password = getStringFromCredentials(credentials, "password");

		uri = new UriInfo(SmtpServiceInfo.SMTP_SCHEME, host, port, username, password).toString();
	}

	return new SmtpServiceInfo(id, uri);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:24,代码来源:SmtpServiceInfoCreator.java

示例4: createUri

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
@Test
public void createUri() {
	String uri = "mysql://joe:[email protected]:1527/big_db";
	UriInfo result = factory.createUri(uri);

	assertUriInfoEquals(result, "localhost", 1527, "joe", "joes_password", "big_db", null);
	assertEquals(uri, result.getUriString());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:9,代码来源:StandardUriInfoFactoryTest.java

示例5: createUriWithQuery

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
@Test
public void createUriWithQuery() {
	String uri = "mysql://joe:[email protected]:1527/big_db?p1=v1&p2=v2";
	UriInfo result = factory.createUri(uri);

	assertUriInfoEquals(result, "localhost", 1527, "joe", "joes_password", "big_db", "p1=v1&p2=v2");
	assertEquals(uri, result.getUriString());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:9,代码来源:StandardUriInfoFactoryTest.java

示例6: createNoUsernamePassword

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
@Test
public void createNoUsernamePassword() {
	String uri = "mysql://localhost:1527/big_db";
	UriInfo result = factory.createUri(uri);

	assertUriInfoEquals(result, "localhost", 1527, null, null, "big_db", null);
	assertEquals(uri, result.getUriString());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:9,代码来源:StandardUriInfoFactoryTest.java

示例7: createWithExplicitParameters

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
@Test
public void createWithExplicitParameters() {
	String uri = "mysql://joe:[email protected]:1527/big_db";
	UriInfo result = factory.createUri("mysql", "localhost", 1527, "joe", "joes_password", "big_db");

	assertUriInfoEquals(result, "localhost", 1527, "joe", "joes_password", "big_db", null);
	assertEquals(uri, result.getUriString());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:9,代码来源:StandardUriInfoFactoryTest.java

示例8: assertUriInfoEquals

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
private void assertUriInfoEquals(UriInfo result, String host, int port,
								 String username, String password, String path, String query) {
	assertEquals(host, result.getHost());
	assertEquals(port, result.getPort());
	assertEquals(username, result.getUserName());
	assertEquals(password, result.getPassword());
	assertEquals(path, result.getPath());
	assertEquals(query, result.getQuery());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:10,代码来源:StandardUriInfoFactoryTest.java

示例9: createServiceInfo

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
public SI createServiceInfo(Map<String, Object> serviceData) {
	String id = getId(serviceData);

	Map<String,Object> credentials = getCredentials(serviceData);

	String jdbcUrl = getStringFromCredentials(credentials, "jdbcUrl");

	String uri = getUriFromCredentials(credentials);

	if (uri == null) {
		String host = getStringFromCredentials(credentials, "hostname", "host");
		int port = getIntFromCredentials(credentials, "port");

		String username = getStringFromCredentials(credentials, "user", "username");
		String password = (String) credentials.get("password");

		String database = (String) credentials.get("name");

		if (host != null) {
			uri = new UriInfo(getDefaultUriScheme(), host, port, username, password, database).toString();
		}
	}

	if (uri == null) {
		uri = jdbcUrl;
	}

	return createServiceInfo(id, uri, jdbcUrl);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:30,代码来源:RelationalServiceInfoCreator.java

示例10: getUriInfo

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
protected UriInfo getUriInfo() {
	return uriInfo;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:4,代码来源:UriBasedServiceInfo.java

示例11: getTestServiceInfo

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
public MongoServiceInfo getTestServiceInfo(String id) {
	return new MongoServiceInfo(id, new UriInfo("mongodb", "host", 0, "username", "password", "db").getUriString());
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:4,代码来源:MongoDbFactoryFactoryTest.java

示例12: validateAndCleanUriInfo

import org.springframework.cloud.util.UriInfo; //导入依赖的package包/类
/**
 * Validate the URI and clean it up by using defaults for any missing information, if possible.
 *
 * @param uriInfo
 *            uri info based on parsed payload
 * @return cleaned up uri info
 */
protected UriInfo validateAndCleanUriInfo(UriInfo uriInfo) {
	return uriInfo;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-connectors,代码行数:11,代码来源:UriBasedServiceInfo.java


注:本文中的org.springframework.cloud.util.UriInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。