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


Java Reader类代码示例

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


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

示例1: afterScan

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Override
public void afterScan(Reader reader, Swagger swagger) {
    OAuth2Definition tokenScheme = new OAuth2Definition();
    tokenScheme.setType("oauth2");
    tokenScheme.setFlow("application");
    tokenScheme.setTokenUrl("https://" + swagger.getHost() + "/oauth2/token");
    tokenScheme.setAuthorizationUrl("https://" + swagger.getHost() + "/oauth2/authorize");
    tokenScheme.addScope("write:everything", "Full access");

    Map<String, SecuritySchemeDefinition> schemes = new HashMap<>();
    schemes.put(TOKEN_AUTH_SCHEME, tokenScheme);

    swagger.setSecurityDefinitions(schemes);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:15,代码来源:SecurityDefinitionConfigurator.java

示例2: afterPropertiesSet

import io.swagger.jaxrs.Reader; //导入依赖的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);
}
 
开发者ID:springside,项目名称:springtime,代码行数:17,代码来源:SpringTimeSwaggerDocsController.java

示例3: getSwaggerDocFromAnnotatedClasses

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
private String getSwaggerDocFromAnnotatedClasses(ZipFile warZipFile, Swagger swaggerStubModel) throws IOException {
	SwaggerAnnotationsScanner annScan = new SwaggerAnnotationsScanner(classLoader, warZipFile);
	Set<Class<?>> classes = annScan.getScannedClasses();
	Reader reader = new Reader(swaggerStubModel);
	Set<String> stubPaths = null;
	if (swaggerStubModel != null && swaggerStubModel.getPaths() != null) {
		stubPaths = swaggerStubModel.getPaths().keySet();
	}
	Swagger swresult = reader.read(classes);
	swresult = addUrlMapping(swresult, stubPaths, annScan.getUrlMapping());
	String ext = FilenameUtils.getExtension(this.outputFile.getName());
	if (ext.equalsIgnoreCase("json")) {
		return createJSONfromPojo(swresult);
	} else if (ext.equalsIgnoreCase("yaml")){
		return createYAMLfromPojo(swresult);
	}
	
	throw new IllegalArgumentException("Unsupported document type: " + ext);
}
 
开发者ID:WASdev,项目名称:tool.swagger.docgen,代码行数:20,代码来源:SwaggerProcessor.java

示例4: SwaggerHandler

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
public SwaggerHandler(
    final Class<? extends Application> applicationClass) {

    final ApplicationPath annotation = applicationClass.getAnnotation(ApplicationPath.class);
    if (annotation != null) {
        baseUri = URI.create(annotation.value()).normalize();
    } else {
        baseUri = URI.create("/");
    }

    Application application;
    try {
        application = applicationClass.newInstance();
    } catch (InstantiationException
        | IllegalAccessException e) {
        throw new ExceptionInInitializerError(e);
    }

    swagger = new ClonableSwagger();
    final Reader swaggerReader = new Reader(swagger);
    final Set<Class<?>> resourceClasses = application.getClasses();
    if (resourceClasses.isEmpty()) {
        final String packageName = applicationClass.getPackage().getName();
        final Reflections reflections = new Reflections(packageName);
        reflections.getTypesAnnotatedWith(Api.class).forEach(swaggerReader::read);
        reflections.getTypesAnnotatedWith(SwaggerDefinition.class).forEach(swaggerReader::read);
    } else {
        swaggerReader.read(applicationClass);
        resourceClasses.forEach(swaggerReader::read);
    }

}
 
开发者ID:trajano,项目名称:app-ms,代码行数:33,代码来源:SwaggerHandler.java

示例5: scanClassAnfFieldLevelAnnotations

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Test
public void scanClassAnfFieldLevelAnnotations() {
    final Swagger swagger = new Reader(new Swagger()).read(ResourceWithKnownInjections.class);
    final List<Parameter> resourceParameters = swagger.getPaths().get("/resource/{id}").getGet().getParameters();
    assertNotNull(resourceParameters);
    assertEquals(4, resourceParameters.size());
    assertEquals("fieldParam", getName(resourceParameters, 0));
    assertEquals("skip", getName(resourceParameters, 1));
    assertEquals("limit", getName(resourceParameters, 2));
    assertEquals("methodParam", getName(resourceParameters, 3));
}
 
开发者ID:minijax,项目名称:minijax,代码行数:12,代码来源:MinijaxSwaggerTest.java

示例6: testFormDataBodyPart

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Test
public void testFormDataBodyPart() {
    final Swagger swagger = new Reader(new Swagger()).read(ResourceWithFormData.class);
    final List<Parameter> parameters = swagger.getPath("/test/document/{documentName}.json").getPost().getParameters();
    assertEquals(5, parameters.size());
    assertEquals("documentName", parameters.get(0).getName());
    assertEquals("document", parameters.get(1).getName());
    assertEquals("document2", parameters.get(2).getName());
    assertEquals("input", parameters.get(3).getName());
    assertEquals("id", parameters.get(4).getName());
}
 
开发者ID:minijax,项目名称:minijax,代码行数:12,代码来源:MinijaxSwaggerTest.java

示例7: testJacksonFeatures

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Test
public void testJacksonFeatures() {
    final Swagger swagger = new Reader(new Swagger()).read(ResourceWithJacksonBean.class);
    final Model o = swagger.getDefinitions().get("JacksonBean");

    assertEquals(Sets.newHashSet("identity", "bean", "code", "message",
            "precodesuf", "premessagesuf"), o.getProperties().keySet());
}
 
开发者ID:minijax,项目名称:minijax,代码行数:9,代码来源:MinijaxSwaggerTest.java

示例8: getSwaggerWithClasses

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
protected Swagger getSwaggerWithClasses() {

        try {
            Reader reader = new Reader(null);
            Swagger swagger = reader.read(getSwaggerClasses());

            processSwagger(swagger);

            return swagger;
        }
        catch (Exception ex) {
            logger.error("Uncaught exception attempting to generate Swagger", ex);
            return null;
        }
    }
 
开发者ID:andyphillips404,项目名称:awplab-core,代码行数:16,代码来源:BaseSwaggerRestProvider.java

示例9: afterScan

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Override
public void afterScan(Reader reader, Swagger swagger) {
    OAuth2Definition tokenScheme = new OAuth2Definition();
    tokenScheme.setType("oauth2");
    tokenScheme.setFlow("application");
    tokenScheme.setTokenUrl("https://" + swagger.getHost() + "/oauth2/token");
    tokenScheme.setAuthorizationUrl("https://" + swagger.getHost() + "/oauth2/authorize");
    tokenScheme.addScope("write:everything", "Full access");

    Map<String, SecuritySchemeDefinition> schemes = new HashMap<>();
    schemes.put(TOKEN_AUTH_SCHEME, tokenScheme);

    swagger.setSecurityDefinitions(schemes);
   //TODO: Have to add wso2-scopes to swagger definition from here
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:16,代码来源:SecurityDefinitionConfigurator.java

示例10: SwaggerModel

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Inject
public SwaggerModel(final ApplicationVersion applicationVersion,
                    final List<SwaggerContributor> contributors)
{
  this.applicationVersion = checkNotNull(applicationVersion);
  this.contributors = checkNotNull(contributors);

  // filter banned types from model, such as Groovy's MetaClass
  ModelConverters.getInstance().addConverter(new ModelFilter());

  this.reader = new Reader(createSwagger());
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:13,代码来源:SwaggerModel.java

示例11: afterScan

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Override
public void afterScan(Reader reader, Swagger swagger) {
    swagger.addSecurityDefinition(TOKEN_AUTH_SCHEME, new BasicAuthDefinition());

    swagger.getPaths().values()
            .stream()
            .forEach(
                    path -> path.getOperations()
                            .stream()
                            .forEach(
                                    operation -> operation.addSecurity(GraviteeApiDefinition.TOKEN_AUTH_SCHEME, null)));
}
 
开发者ID:gravitee-io,项目名称:gravitee-management-rest-api,代码行数:13,代码来源:GraviteeApiDefinition.java

示例12: scanResourcesForJaxrsAnnotations

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
protected synchronized Swagger scanResourcesForJaxrsAnnotations(final Application app, final ServletConfig sc) {
    Swagger swagger = null;
    final Scanner scanner = ScannerFactory.getScanner();
    LOGGER.debug("using scanner " + scanner);

    if (scanner != null) {
        SwaggerSerializers.setPrettyPrint(scanner.getPrettyPrint());

        swagger = getSwagger();

        Set<Class<?>> classes = null;
        if (scanner instanceof JaxrsScanner) {
            final JaxrsScanner jaxrsScanner = (JaxrsScanner) scanner;
            classes = jaxrsScanner.classesFromContext(app, sc);
        } else {
            classes = scanner.classes();
        }
        if (classes != null) {
            final Reader reader = new Reader(swagger);
            swagger = reader.read(classes);
            if (scanner instanceof SwaggerConfig) {
                swagger = ((SwaggerConfig) scanner).configure(swagger);
            } else {
                LOGGER.debug("no configurator");
            }
        }
    }
    initialized = true;
    return swagger;
}
 
开发者ID:travel-cloud,项目名称:Cheddar,代码行数:31,代码来源:SwaggerSpecResource.java

示例13: beforeScan

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Override
public void beforeScan(Reader reader, Swagger swagger) {
	SwaggerContext.setSwagger(swagger);
}
 
开发者ID:holon-platform,项目名称:holon-jaxrs,代码行数:5,代码来源:SwaggerContextListener.java

示例14: afterScan

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Override
public void afterScan(Reader reader, Swagger swagger) {
	SwaggerContext.setSwagger(null);
}
 
开发者ID:holon-platform,项目名称:holon-jaxrs,代码行数:5,代码来源:SwaggerContextListener.java

示例15: testIssue2031

import io.swagger.jaxrs.Reader; //导入依赖的package包/类
@Test
public void testIssue2031() {
    final Swagger swagger = new Reader(new Swagger()).read(Resource2031.class);
    assertNotNull(swagger);

}
 
开发者ID:minijax,项目名称:minijax,代码行数:7,代码来源:MinijaxSwaggerTest.java


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