本文整理了Java中io.swagger.models.Scheme.forValue()
方法的一些代码示例,展示了Scheme.forValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheme.forValue()
方法的具体详情如下:
包路径:io.swagger.models.Scheme
类名称:Scheme
方法名:forValue
暂无
代码示例来源:origin: apache/servicecomb-java-chassis
private void convertProtocols(String protocols, Operation operation) {
if (protocols == null) {
return;
}
for (String protocol : protocols.split(SEPARATOR)) {
if (StringUtils.isEmpty(protocol)) {
continue;
}
operation.addScheme(Scheme.forValue(protocol));
}
}
代码示例来源:origin: apache/servicecomb-java-chassis
private Scheme convertScheme(io.swagger.annotations.SwaggerDefinition.Scheme annotationScheme) {
return Scheme.forValue(annotationScheme.name());
}
代码示例来源:origin: kongchen/swagger-maven-plugin
protected void updateOperationProtocols(ApiOperation apiOperation, Operation operation) {
if(apiOperation == null) {
return;
}
String[] protocols = apiOperation.protocols().split(",");
for (String protocol : protocols) {
String trimmed = protocol.trim();
if (!trimmed.isEmpty()) {
operation.scheme(Scheme.forValue(trimmed));
}
}
}
代码示例来源:origin: kongchen/swagger-maven-plugin
public AbstractDocumentSource(Log log, ApiSource apiSource) throws MojoFailureException {
LOG = log;
this.outputPath = apiSource.getOutputPath();
this.templatePath = apiSource.getTemplatePath();
this.swaggerPath = apiSource.getSwaggerDirectory();
this.modelSubstitute = apiSource.getModelSubstitute();
this.jsonExampleValues = apiSource.isJsonExampleValues();
swagger = new Swagger();
if (apiSource.getSchemes() != null) {
for (String scheme : apiSource.getSchemes()) {
swagger.scheme(Scheme.forValue(scheme));
}
}
// read description from file
if (apiSource.getDescriptionFile() != null) {
try {
InputStream is = new FileInputStream(apiSource.getDescriptionFile());
apiSource.getInfo().setDescription(IOUtils.toString(is));
is.close();
} catch (IOException e) {
throw new MojoFailureException(e.getMessage(), e);
}
}
swagger.setHost(apiSource.getHost());
swagger.setInfo(apiSource.getInfo());
swagger.setBasePath(apiSource.getBasePath());
swagger.setExternalDocs(apiSource.getExternalDocs());
this.apiSource = apiSource;
}
代码示例来源:origin: wso2/msf4j
private static Set<Scheme> parseSchemes(String schemes) {
final Set<Scheme> result = EnumSet.noneOf(Scheme.class);
for (String item : StringUtils.trimToEmpty(schemes).split(",")) {
final Scheme scheme = Scheme.forValue(StringUtils.trimToNull(item));
if (scheme != null) {
result.add(scheme);
}
}
return result;
}
代码示例来源:origin: org.wso2.msf4j/msf4j-swagger
private static Set<Scheme> parseSchemes(String schemes) {
final Set<Scheme> result = EnumSet.noneOf(Scheme.class);
for (String item : StringUtils.trimToEmpty(schemes).split(",")) {
final Scheme scheme = Scheme.forValue(StringUtils.trimToNull(item));
if (scheme != null) {
result.add(scheme);
}
}
return result;
}
代码示例来源:origin: noboomu/proteus
private static Set<Scheme> parseSchemes(String schemes) {
final Set<Scheme> result = EnumSet.noneOf(Scheme.class);
for (String item : StringUtils.trimToEmpty(schemes).split(",")) {
final Scheme scheme = Scheme.forValue(StringUtils.trimToNull(item));
if (scheme != null) {
result.add(scheme);
}
}
return result;
}
代码示例来源:origin: javagossip/dorado
private static Set<Scheme> parseSchemes(String schemes) {
final Set<Scheme> result = EnumSet.noneOf(Scheme.class);
for (String item : StringUtils.trimToEmpty(schemes).split(",")) {
final Scheme scheme = Scheme.forValue(StringUtils.trimToNull(item));
if (scheme != null) {
result.add(scheme);
}
}
return result;
}
代码示例来源:origin: io.swagger/swagger-jaxrs
private static Set<Scheme> parseSchemes(String schemes) {
final Set<Scheme> result = EnumSet.noneOf(Scheme.class);
for (String item : StringUtils.trimToEmpty(schemes).split(",")) {
final Scheme scheme = Scheme.forValue(StringUtils.trimToNull(item));
if (scheme != null) {
result.add(scheme);
}
}
return result;
}
代码示例来源:origin: yangfuhai/jboot
private static List<Scheme> parseSchemes(String schemes) {
final List<Scheme> result = new ArrayList<Scheme>();
for (String item : StringUtils.trimToEmpty(schemes).split(",")) {
final Scheme scheme = Scheme.forValue(StringUtils.trimToNull(item));
if (scheme != null && !result.contains(scheme)) {
result.add(scheme);
}
}
return result;
}
代码示例来源:origin: Sayi/swagger-dubbo
private static List<Scheme> parseSchemes(String schemes) {
final List<Scheme> result = new ArrayList<Scheme>();
for (String item : StringUtils.trimToEmpty(schemes).split(",")) {
final Scheme scheme = Scheme.forValue(StringUtils.trimToNull(item));
if (scheme != null && !result.contains(scheme)) {
result.add(scheme);
}
}
return result;
}
代码示例来源:origin: org.apache.servicecomb/swagger-generator-core
private void convertProtocols(String protocols, Operation operation) {
if (protocols == null) {
return;
}
for (String protocol : protocols.split(SEPARATOR)) {
if (StringUtils.isEmpty(protocol)) {
continue;
}
operation.addScheme(Scheme.forValue(protocol));
}
}
代码示例来源:origin: com.github.phillip-kruger/apiee-core
private List<Scheme> toSchemeList(List<Scheme> original,String schemes) {
List<Scheme> schemeList = new ArrayList<>();
toList(schemes).forEach((scheme) -> {
schemeList.add(Scheme.forValue(scheme));
});
if(original!=null){
original.addAll(schemeList);
return original;
}else{
return schemeList;
}
}
代码示例来源:origin: org.apache.servicecomb/swagger-generator-core
private Scheme convertScheme(io.swagger.annotations.SwaggerDefinition.Scheme annotationScheme) {
return Scheme.forValue(annotationScheme.name());
}
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.core
private void setSwaggerSchemes(Swagger swagger, Set<String> transports) {
List<String> swaggerSchemes = Stream.of(Scheme.values()).map(Scheme::name).collect(Collectors.toList());
List<Scheme> schemes = new ArrayList<>();
if (transports.size() != 0) {
for (String transport: transports) {
if (swaggerSchemes.contains(transport)) {
schemes.add(Scheme.forValue(transport));
}
}
}
if (!schemes.isEmpty()) {
swagger.setSchemes(schemes);
}
}
代码示例来源:origin: wso2/carbon-apimgt
private void setSwaggerSchemes(Swagger swagger, Set<String> transports) {
List<String> swaggerSchemes = Stream.of(Scheme.values()).map(Scheme::name).collect(Collectors.toList());
List<Scheme> schemes = new ArrayList<>();
if (transports.size() != 0) {
for (String transport: transports) {
if (swaggerSchemes.contains(transport)) {
schemes.add(Scheme.forValue(transport));
}
}
}
if (!schemes.isEmpty()) {
swagger.setSchemes(schemes);
}
}
代码示例来源:origin: io.gravitee.management/gravitee-management-api-service
private Swagger transformV2(String content, Map<String, String> config) {
Swagger swagger = new SwaggerParser().parse(content);
if (swagger != null && config != null && config.get("tryItURL") != null) {
URI newURI = URI.create(config.get("tryItURL"));
swagger.setSchemes(Collections.singletonList(Scheme.forValue(newURI.getScheme())));
swagger.setHost((newURI.getPort() != -1) ? newURI.getHost() + ':' + newURI.getPort() : newURI.getHost());
swagger.setBasePath((newURI.getRawPath().isEmpty()) ? "/" : newURI.getRawPath());
}
return swagger;
}
代码示例来源:origin: gravitee-io/gravitee-management-rest-api
private Swagger transformV2(String content, Map<String, String> config) {
Swagger swagger = new SwaggerParser().parse(content);
if (swagger != null && config != null && config.get("tryItURL") != null) {
URI newURI = URI.create(config.get("tryItURL"));
swagger.setSchemes(Collections.singletonList(Scheme.forValue(newURI.getScheme())));
swagger.setHost((newURI.getPort() != -1) ? newURI.getHost() + ':' + newURI.getPort() : newURI.getHost());
swagger.setBasePath((newURI.getRawPath().isEmpty()) ? "/" : newURI.getRawPath());
}
return swagger;
}
代码示例来源:origin: openmrs/openmrs-module-webservices.rest
@RequestMapping(method = RequestMethod.GET)
public @ResponseBody
String getSwaggerSpecification(HttpServletRequest request) throws Exception {
String host = request.getHeader(HttpHeaders.HOST);
String scheme = request.getHeader(HttpHeaders.X_FORWARDED_PROTO);
if (scheme == null) {
scheme = request.getScheme();
}
return new SwaggerSpecificationCreator()
.host(host)
.basePath(request.getContextPath() + "/ws/rest/v1")
.scheme(Scheme.forValue(scheme))
.getJSON();
}
代码示例来源:origin: de.taimos/spring-cxf-daemon
private void configureServerURL(Swagger swagger) {
SplitURL split = URLUtils.splitURL(System.getProperty(SpringCXFProperties.SERVER_URL, "localhost"));
swagger.scheme(Scheme.forValue(split.getScheme()));
swagger.host(split.getHost() + ":" + split.getPort());
swagger.basePath(System.getProperty(SpringCXFProperties.JAXRS_PATH));
}
内容来源于网络,如有侵权,请联系作者删除!