本文整理汇总了Java中io.swagger.jaxrs.config.BeanConfig.setTermsOfServiceUrl方法的典型用法代码示例。如果您正苦于以下问题:Java BeanConfig.setTermsOfServiceUrl方法的具体用法?Java BeanConfig.setTermsOfServiceUrl怎么用?Java BeanConfig.setTermsOfServiceUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.jaxrs.config.BeanConfig
的用法示例。
在下文中一共展示了BeanConfig.setTermsOfServiceUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activate
import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Override
public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(SwaggerArchive.SWAGGER_CONFIGURATION_PATH);
if (in == null) {
// No config available. Print a warning and return
System.err.println("WARN: No swagger configuration found. Swagger not activated.");
return;
}
SwaggerConfig config = new SwaggerConfig(in);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setHost((String) config.get(SwaggerConfig.Key.HOST));
beanConfig.setLicense((String) config.get(SwaggerConfig.Key.LICENSE));
beanConfig.setLicenseUrl((String) config.get(SwaggerConfig.Key.LICENSE_URL));
beanConfig.setTermsOfServiceUrl((String) config.get(SwaggerConfig.Key.TERMS_OF_SERVICE_URL));
beanConfig.setResourcePackage((String) config.get(SwaggerConfig.Key.PACKAGES));
beanConfig.setVersion((String) config.get(SwaggerConfig.Key.VERSION));
beanConfig.setBasePath((String) config.get(SwaggerConfig.Key.ROOT));
beanConfig.setContact((String) config.get(SwaggerConfig.Key.CONTACT));
beanConfig.setDescription((String) config.get(SwaggerConfig.Key.DESCRIPTION));
beanConfig.setTitle((String) config.get(SwaggerConfig.Key.TITLE));
beanConfig.setPrettyPrint((String) config.get(SwaggerConfig.Key.PRETTY_PRINT));
beanConfig.setSchemes((String[]) config.get(SwaggerConfig.Key.SCHEMES));
beanConfig.setScan(true);
}
示例2: getBeanConfig
import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private BeanConfig getBeanConfig() {
BeanConfig beanConfig = new BeanConfig();
beanConfig.setHost(getConfig("swagger.host"));
beanConfig.setSchemes(getConfig("swagger.schemes").split(","));
beanConfig.setTitle(getConfig("swagger.title"));
beanConfig.setVersion(getConfig("swagger.version"));
beanConfig.setContact(getConfig("swagger.contact"));
beanConfig.setLicense(getConfig("swagger.license"));
beanConfig.setBasePath(getConfig("swagger.base_path"));
beanConfig.setLicenseUrl(getConfig("swagger.licenseUrl"));
beanConfig.setDescription(getConfig("swagger.description"));
beanConfig.setPrettyPrint(getConfig("swagger.pretty_print"));
beanConfig.setTermsOfServiceUrl(getConfig("swagger.terms_of_service_url"));
// Must be called last
beanConfig.setResourcePackage(resourcePackages());
beanConfig.setScan(true);
return beanConfig;
}
示例3: activate
import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Override
public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(SwaggerArchive.SWAGGER_CONFIGURATION_PATH);
if (in == null) {
// try again, we must go deeper.
in = Thread.currentThread().getContextClassLoader().getResourceAsStream("WEB-INF/classes/" + SwaggerArchive.SWAGGER_CONFIGURATION_PATH);
}
if (in == null) {
// No config available. Print a warning and return
SwaggerMessages.MESSAGES.noConfigurationFound();
return;
}
try {
SwaggerConfig config = new SwaggerConfig(in);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setHost((String) config.get(SwaggerConfig.Key.HOST));
beanConfig.setLicense((String) config.get(SwaggerConfig.Key.LICENSE));
beanConfig.setLicenseUrl((String) config.get(SwaggerConfig.Key.LICENSE_URL));
beanConfig.setTermsOfServiceUrl((String) config.get(SwaggerConfig.Key.TERMS_OF_SERVICE_URL));
// some type inconsistencies in the API (String vs String[])
String[] packages = (String[]) config.get(SwaggerConfig.Key.PACKAGES);
if (packages != null) {
StringBuffer sb = new StringBuffer();
for (String s : packages) {
sb.append(s).append(',');
}
beanConfig.setResourcePackage(sb.toString());
}
beanConfig.setVersion((String) config.get(SwaggerConfig.Key.VERSION));
beanConfig.setBasePath((String) config.get(SwaggerConfig.Key.ROOT));
beanConfig.setContact((String) config.get(SwaggerConfig.Key.CONTACT));
beanConfig.setDescription((String) config.get(SwaggerConfig.Key.DESCRIPTION));
beanConfig.setTitle((String) config.get(SwaggerConfig.Key.TITLE));
beanConfig.setPrettyPrint((String) config.get(SwaggerConfig.Key.PRETTY_PRINT));
beanConfig.setSchemes((String[]) config.get(SwaggerConfig.Key.SCHEMES));
beanConfig.setScan(true);
} catch (IOException e) {
throw new ServiceRegistryException(e);
}
}