本文整理汇总了Java中io.swagger.models.Info.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Info.setTitle方法的具体用法?Java Info.setTitle怎么用?Java Info.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.Info
的用法示例。
在下文中一共展示了Info.setTitle方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterPropertiesSet
import io.swagger.models.Info; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
swagger = new Swagger();
Info info = new Info();
info.setTitle("GreetingService");
swagger.setInfo(info);
Map<String, Object> beans = applicationContext.getBeansWithAnnotation(SpringTimeService.class);
Set<Class<?>> classes = new HashSet<Class<?>>();
for (Object bean : beans.values()) {
classes.add(bean.getClass());
}
Reader reader = new Reader(swagger, ReaderConfigUtils.getReaderConfig(null));
swagger = reader.read(classes);
}
示例2: init
import io.swagger.models.Info; //导入方法依赖的package包/类
public void init() {
if (!config.isConfigOk()) {
return;
}
swagger = new Swagger();
swagger.setHost(config.getHost());
swagger.setBasePath("/");
swagger.addScheme(HTTP);
swagger.addScheme(HTTPS);
Info swaggerInfo = new Info();
swaggerInfo.setDescription(config.getDescription());
swaggerInfo.setVersion(config.getVersion());
swaggerInfo.setTitle(config.getTitle());
swaggerInfo.setTermsOfService(config.getTermsOfService());
Contact contact = new Contact();
contact.setName(config.getContactName());
contact.setEmail(config.getContactEmail());
contact.setUrl(config.getContactUrl());
swaggerInfo.setContact(contact);
License license = new License();
license.setName(config.getLicenseName());
license.setUrl(config.getLicenseUrl());
swaggerInfo.setLicense(license);
swagger.setInfo(swaggerInfo);
List<Class> classes = ClassScanner.scanClassByAnnotation(RequestMapping.class, false);
Reader.read(swagger, classes);
}
示例3: getSwagger
import io.swagger.models.Info; //导入方法依赖的package包/类
public ClonableSwagger getSwagger(final String basePath,
final UriInfo uriInfo) {
ClonableSwagger swagger = swaggerMap.get(basePath);
if (swagger == null) {
final int i = swaggerPaths.get(basePath);
swagger = new ClonableSwagger();
final String title = env.getProperty(String.format("swagger[%d].info.title", i));
final String version = env.getProperty(String.format("swagger[%d].info.version", i));
swagger.setBasePath('/' + basePath);
final Info info = new Info();
info.setTitle(title);
info.setVersion(version);
swagger.setInfo(info);
final Map<String, Path> pathsMap = new TreeMap<>();
final Map<String, Model> definitionsMap = new TreeMap<>();
final Map<String, SecuritySchemeDefinition> securityDefinitionsMap = new TreeMap<>();
processUris(pathsMap, definitionsMap, securityDefinitionsMap, i);
swagger.setPaths(pathsMap);
swagger.setDefinitions(definitionsMap);
swagger.setSecurityDefinitions(securityDefinitionsMap);
swaggerMap.putIfAbsent(basePath, swagger);
}
return swagger.withUriInfo(uriInfo);
}
示例4: execute
import io.swagger.models.Info; //导入方法依赖的package包/类
@Override
public void execute() {
BeanConfig swaggerConfig = new BeanConfig();
swaggerConfig.setResourcePackage(PropertiesUtil.get("base", "swagger.scan"));
swaggerConfig.setVersion("1.0.0");
swaggerConfig.setSchemes(new String[] { "http", "https" });
swaggerConfig.setHost("localhost");
swaggerConfig.setBasePath("/service");
swaggerConfig.setScan(true);
Info info = new Info();
info.setTitle(PropertiesUtil.get("base", "serviceCode") + " API");
info.setDescription(PropertiesUtil.get("base", "serviceDescription"));
swaggerConfig.setInfo(info);
}
示例5: setupSwagger
import io.swagger.models.Info; //导入方法依赖的package包/类
@Override
public void setupSwagger(BeanConfig beanConfig) {
Info info = new Info();
info.setTitle("DPB1 Epitope Service");
info.setDescription("This service reports on alleles and their associated immunogenicity groups and provides matching functions.");
beanConfig.setResourcePackage("org.nmdp.service.epitope.resource");
beanConfig.setPrettyPrint(true);
beanConfig.setInfo(info);
}
示例6: getResourceSwaggerJson
import io.swagger.models.Info; //导入方法依赖的package包/类
public String getResourceSwaggerJson(){
SwaggerSerializers.setPrettyPrint(true);
ReaderConfig readerConfig = new PlayReaderConfig();
Swagger swagger = new Swagger();
PlaySwaggerConfig config = PlayConfigFactory.getConfig();
swagger.setHost(config.getHost());
swagger.setBasePath(config.getBasePath());
Info info = new Info();
info.setVersion(config.getVersion());
info.setTitle(config.getTitle());
info.setContact(new Contact().name(config.getContact()));
info.setLicense(new License().name(config.getLicense()).url(config.getLicenseUrl()));
info.setDescription(config.getDescription());
info.setTermsOfService(config.getTermsOfServiceUrl());
swagger.setInfo(info);
PlayReader reader = new PlayReader(swagger, readerConfig);
swagger = reader.read(controllerClasses);
ObjectMapper commonMapper = Json.mapper();
try {
return commonMapper.writeValueAsString(swagger);
} catch (JsonProcessingException e) {
Logger.error(e.getMessage());
return "";
}
}
示例7: start
import io.swagger.models.Info; //导入方法依赖的package包/类
@Override
public ServiceHost start() throws Throwable {
SwaggerDescriptorService swagger = new SwaggerDescriptorService();
Info info = new Info();
info.setDescription(INFO_DESCRIPTION);
info.setTermsOfService(INFO_TERMS_OF_SERVICE);
info.setTitle("title");
info.setVersion("version");
swagger.setExcludeUtilities(true);
swagger.setExcludedPrefixes(
"/core/synch-tasks",
"/core/callbacks",
"/core/netty-maint-proxies",
"/core/query-page-forwarding",
"/core/service-context-index");
swagger.setInfo(info);
super.start();
super.startDefaultCoreServicesSynchronously();
// Start the root namespace factory: this will respond to the root URI (/) and list all
// the factory services.
super.startService(new RootNamespaceService());
this.startService(swagger);
this.startService(
Operation.createPost(UriUtils.buildFactoryUri(this, ExampleService.class)),
ExampleService.createFactory());
this.startService(Operation.createPost(UriUtils.buildFactoryUri(this, CarService.class)),
CarService.createFactory());
this.startService(Operation.createPost(UriUtils.buildUri(this, UiService.class)),
new UiService());
this.startService(
Operation.createPost(UriUtils.buildFactoryUri(this, ExampleService.class)),
new ExampleService());
this.startService(Operation.createPost(UriUtils.buildUri(this, TokenService.class)),
new TokenService());
this.startService(Operation.createPost(UriUtils.buildUri(this, NsOwnerService.class)),
new NsOwnerService());
return this;
}
示例8: setup
import io.swagger.models.Info; //导入方法依赖的package包/类
@BeforeClass
public static void setup() throws Throwable {
host = VerificationHost.create(0);
System.out.println("Host details: " + host);
SwaggerDescriptorService swagger = new SwaggerDescriptorService();
Info info = new Info();
info.setDescription(INFO_DESCRIPTION);
info.setTermsOfService(INFO_TERMS_OF_SERVICE);
info.setTitle("title");
info.setVersion("version");
swagger.setSwaggerPostprocessor( s -> s.getInfo().setVersion("postprocessed"));
swagger.setInfo(info);
swagger.setExcludedPrefixes("/core/authz/");
swagger.setStripPackagePrefixes("com:vmware:xenon:common:");
host.start();
host.startService(swagger);
host.startService(
Operation.createPost(UriUtils.buildFactoryUri(host, ExampleService.class)),
ExampleService.createFactory());
host.startService(Operation.createPost(UriUtils.buildFactoryUri(host, CarService.class)),
CarService.createFactory());
host.startService(Operation.createPost(UriUtils.buildUri(host, UiService.class)),
new UiService());
host.startService(
Operation.createPost(UriUtils.buildFactoryUri(host, ExampleService.class)),
new ExampleService());
host.startService(Operation.createPost(UriUtils.buildUri(host, TokenService.class)),
new TokenService());
host.startService(Operation.createPost(UriUtils.buildUri(host, NsOwnerService.class)),
new NsOwnerService());
host.waitForServiceAvailable(SwaggerDescriptorService.SELF_LINK);
}
示例9: parseCommon
import io.swagger.models.Info; //导入方法依赖的package包/类
private static Swagger parseCommon(String requestUrl, Project project) {
Swagger swagger = new Swagger();
Contact contact = new Contact();
/*contact.setName("Convertigo Support");
contact.setEmail("[email protected]");
contact.setUrl("http://www.convertigo.com/#developers");*/
Info info = new Info();
info.setContact(contact);
info.setTitle("Convertigo REST API");
info.setDescription("Find here all deployed projects");
if (project != null) {
info.setDescription(project.getComment());
info.setVersion(project.getVersion());
}
List<Scheme> schemes = new ArrayList<Scheme>();
String host;
String basePath;
Matcher matcher = parseRequestUrl.matcher(requestUrl);
if (matcher.find()) {
schemes.add(matcher.group(1) == null ? Scheme.HTTP : Scheme.HTTPS);
host = matcher.group(2);
basePath = matcher.group(3);
} else {
String webAppPath = EnginePropertiesManager.getProperty(PropertyName.APPLICATION_SERVER_CONVERTIGO_URL);
int index = webAppPath.indexOf("://") + 3;
host = webAppPath.substring(index, webAppPath.indexOf('/', index));
basePath = webAppPath.substring(index + host.length()) + "/api";
schemes.add(Scheme.HTTP);
schemes.add(Scheme.HTTPS);
}
swagger.setInfo(info);
swagger.setSchemes(schemes);
swagger.setHost(host);
swagger.setBasePath(basePath);
swagger.setConsumes(Arrays.asList("multipart/form-data", MimeType.WwwForm.value(), MimeType.Json.value(), MimeType.Xml.value()));
swagger.setProduces(Arrays.asList(MimeType.Json.value(), MimeType.Xml.value()));
return swagger;
}
示例10: build
import io.swagger.models.Info; //导入方法依赖的package包/类
public Info build(){
Info info = new Info();
info.setVersion(maybeVersion.get());
info.setTitle(maybeTitle.get());
return info;
}
示例11: initSwagger
import io.swagger.models.Info; //导入方法依赖的package包/类
public void initSwagger(BeanConfig swaggerConfig, Map<String, Object> config) {
// configure swagger options
String s = (String) config.get("swagger.version");
if (s != null) {
swaggerConfig.setVersion(s);
}
s = (String) config.get("base.path");
if (s != null) {
swaggerConfig.setBasePath(s);
}
s = (String) config.get("host");
if (s != null) {
swaggerConfig.setHost(s);
}
s = (String) config.get("cors");
if (s != null) {
cors = "true".equalsIgnoreCase(s);
}
s = (String) config.get("schemes");
if (s == null) {
// deprecated due typo
s = (String) config.get("schemas");
}
if (s != null) {
String[] schemes = s.split(",");
swaggerConfig.setSchemes(schemes);
} else {
// assume http by default
swaggerConfig.setSchemes(new String[]{"http"});
}
String version = (String) config.get("api.version");
String title = (String) config.get("api.title");
String description = (String) config.get("api.description");
String termsOfService = (String) config.get("api.termsOfService");
String licenseName = (String) config.get("api.license.name");
String licenseUrl = (String) config.get("api.license.url");
String contactName = (String) config.get("api.contact.name");
String contactUrl = (String) config.get("api.contact.url");
String contactEmail = (String) config.get("api.contact.email");
Info info = new Info();
info.setVersion(version);
info.setTitle(title);
info.setDescription(description);
info.setTermsOfService(termsOfService);
if (licenseName != null || licenseUrl != null) {
License license = new License();
license.setName(licenseName);
license.setUrl(licenseUrl);
info.setLicense(license);
}
if (contactName != null || contactUrl != null || contactEmail != null) {
Contact contact = new Contact();
contact.setName(contactName);
contact.setUrl(contactUrl);
contact.setEmail(contactEmail);
info.setContact(contact);
}
swaggerConfig.setInfo(info);
}
示例12: RestAPIResourceConfig
import io.swagger.models.Info; //导入方法依赖的package包/类
public RestAPIResourceConfig() {
register(new AbstractBinder() {
@Override
protected void configure() {
bindFactory(PipelineStoreInjector.class).to(PipelineStoreTask.class);
bindFactory(AclStoreInjector.class).to(AclStoreTask.class);
bindFactory(StageLibraryInjector.class).to(StageLibraryTask.class);
bindFactory(PrincipalInjector.class).to(Principal.class);
bindFactory(URIInjector.class).to(URI.class);
bindFactory(ConfigurationInjector.class).to(Configuration.class);
bindFactory(RuntimeInfoInjector.class).to(RuntimeInfo.class);
bindFactory(BuildInfoInjector.class).to(BuildInfo.class);
bindFactory(StandAndClusterManagerInjector.class).to(Manager.class);
bindFactory(SupportBundleInjector.class).to(SupportBundleManager.class);
bindFactory(UserGroupManagerInjector.class).to(UserGroupManager.class);
bindFactory(ActivationInjector.class).to(Activation.class);
}
});
register(RolesAllowedDynamicFeature.class);
register(CsrfProtectionFilter.class);
register(MultiPartFeature.class);
//Hooking up Swagger-Core
register(ApiListingResource.class);
register(SwaggerSerializers.class);
//Configure and Initialize Swagger
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.0");
beanConfig.setBasePath("/rest");
beanConfig.setResourcePackage(RestAPI.class.getPackage().getName());
beanConfig.setScan(true);
beanConfig.setTitle("Data Collector RESTful API");
Info info = new Info();
info.setTitle("Data Collector RESTful API");
info.setDescription("An Enterprise-Grade Approach to Managing Big Data in Motion");
info.setVersion("1.0.0");
beanConfig.setInfo(info);
}