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


Java BeanConfig.setBasePath方法代码示例

本文整理汇总了Java中io.swagger.jaxrs.config.BeanConfig.setBasePath方法的典型用法代码示例。如果您正苦于以下问题:Java BeanConfig.setBasePath方法的具体用法?Java BeanConfig.setBasePath怎么用?Java BeanConfig.setBasePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.swagger.jaxrs.config.BeanConfig的用法示例。


在下文中一共展示了BeanConfig.setBasePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);

}
 
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:30,代码来源:SwaggerActivator.java

示例2: swaggerConfig

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Bean
public BeanConfig swaggerConfig() {
	final BeanConfig beanConfig = new BeanConfig();
	beanConfig.setResourcePackage("com.github.sbugat.samplerest.resource");
	beanConfig.setVersion("1.0.0");
	beanConfig.setHost("localhost:8080");
	beanConfig.setBasePath(servletContext.getContextPath());
	beanConfig.setTitle("Swagger CXF, JAX-RS 2.0 sample");
	beanConfig.setDescription("This is a Swagger CXF, JAX-RS 2.0 sample API.");
	beanConfig.setContact("Sylvain Bugat");
	beanConfig.setLicense("Apache 2.0");
	beanConfig.setLicenseUrl("https://github.com/Sylvain-Bugat/swagger-cxf-rest-skeleton/blob/master/LICENSE");

	beanConfig.getSwagger().addSecurityDefinition("api_token", new ApiKeyAuthDefinition("api_token", In.HEADER));

	beanConfig.setScan(true);

	return beanConfig;
}
 
开发者ID:Sylvain-Bugat,项目名称:swagger-cxf-rest-skeleton,代码行数:20,代码来源:ApplicationConfiguration.java

示例3: RESTConfig

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
public RESTConfig() {

        BeanConfig beanConfig = new BeanConfig();
        beanConfig.setVersion(STORR_API_VERSION);
        beanConfig.setSchemes(new String[]{"http"});
        beanConfig.setBasePath("/");
        beanConfig.setResourcePackage(REST_PACKAGE);
        beanConfig.setTitle("storr API");
        beanConfig.setDescription("This REST API exposes the basic functions of storr. " +
                "storr is a NoSQL store intended to provide easy storage of arbitrary tuples");
        beanConfig.setScan(true);
        beanConfig.setPrettyPrint(true);

        packages(REST_PACKAGE);

        register(LoggingFeature.class);
        register(ApiListingResource.class);
        register(SwaggerSerializers.class);
    }
 
开发者ID:stacs-srg,项目名称:storr,代码行数:20,代码来源:RESTConfig.java

示例4: configureSwagger

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private void configureSwagger() {
	// Available at localhost:port/swagger.json
	this.register(ApiListingResource.class);
	this.register(SwaggerSerializers.class);

	BeanConfig config = new BeanConfig();
	// config.setConfigId(title);
	config.setTitle(title);
	config.setDescription(description);
	config.setVersion(version);
	config.setContact(contact);
	config.setSchemes(schemes.split(","));
	config.setBasePath(basePath);
	config.setResourcePackage(resourcePackage);
	config.setPrettyPrint(prettyPrint);
	config.setScan(scan);	
}
 
开发者ID:jotorren,项目名称:microservices-transactions-tcc,代码行数:18,代码来源:WebServicesConfiguration.java

示例5: setupBeanConfig

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Override
protected void setupBeanConfig() {
    final BeanConfig beanConfig = new BeanConfig();

    String basePath = System.getProperty(SystemProperty.BASE_PATH, SystemProperty.BASE_PATH_DEFAULT);
    if (!basePath.startsWith("/")) {
        basePath = "/" + basePath;
    }

    beanConfig.setBasePath(basePath + '/' + VERSION);

    beanConfig.setConfigId(VERSION);
    beanConfig.setScannerId(VERSION);

    beanConfig.setResourcePackage("uk.gov.gchq.gaffer.rest.service.v1");
    beanConfig.setScan(true);
}
 
开发者ID:gchq,项目名称:Gaffer,代码行数:18,代码来源:ApplicationConfigV1.java

示例6: setupBeanConfig

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Override
protected void setupBeanConfig() {
    final BeanConfig beanConfig = new BeanConfig();

    String basePath = System.getProperty(SystemProperty.BASE_PATH, SystemProperty.BASE_PATH_DEFAULT);
    if (!basePath.startsWith("/")) {
        basePath = "/" + basePath;
    }

    beanConfig.setBasePath(basePath + '/' + VERSION);

    beanConfig.setConfigId(VERSION);
    beanConfig.setScannerId(VERSION);

    beanConfig.setResourcePackage("uk.gov.gchq.gaffer.rest.service.v2");
    beanConfig.setScan(true);
}
 
开发者ID:gchq,项目名称:Gaffer,代码行数:18,代码来源:ApplicationConfigV2.java

示例7: ApplicationJAXRS

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
public ApplicationJAXRS() {
    
    // Configurando o Swagger de forma programática
    BeanConfig beanConfig = new BeanConfig();
    // Básico
    //beanConfig.setTitle("Discovery Service");
    //beanConfig.setVersion("0.1");
    //beanConfig.setSchemes(new String[]{"http"});
    beanConfig.setHost("localhost:8080");
    beanConfig.setBasePath("/pswot/discovery/v0.1");
    beanConfig.setResourcePackage(DiscoveryService.class.getPackage().getName());
    // Licença
    //beanConfig.setLicense("Apache 2.0");
    //beanConfig.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html");
    // Contato
    //beanConfig.setContact("mailto:[email protected]");
    //beanConfig.setDescription("This is the documentation of the "
    //        + "RESTful API to access Discovery PSWoT functionalities.");
    beanConfig.setScan(true);
    
}
 
开发者ID:nailtonvieira,项目名称:cloudsemanticwot,代码行数:22,代码来源:ApplicationJAXRS.java

示例8: init

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);

    ConfigureAdaptor scouterConf = ConfigureManager.getConfigure();
    if (!scouterConf.isNetHttpApiSwaggerEnabled()) {
        return;
    }

    BeanConfig beanConfig = new BeanConfig();

    String serverIp = scouterConf.getNetHttpApiSwaggerHostIp();
    if (StringUtils.isNotBlank(serverIp)) {
        beanConfig.setHost(serverIp + ":" + String.valueOf(scouterConf.getNetHttpPort()));
    }

    beanConfig.setVersion(this.apiVersion);
    beanConfig.setSchemes(new String[]{"http", "https"});
    beanConfig.setDescription("<a href='https://github.com/scouter-project/scouter/blob/master/scouter.document/tech/Web-API-Guide.md' target='_blank'> [Scouter document page] Scouter Web API Guide</a>");
    beanConfig.setTitle("Scouter HTTP APIs");
    beanConfig.setBasePath("/scouter");
    beanConfig.setResourcePackage("scouterx.webapp");
    beanConfig.setFilterClass(this.filterClass);
    beanConfig.setScan(true);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:26,代码来源:Bootstrap.java

示例9: bildSwaggerConfig

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private void bildSwaggerConfig() {
    BeanConfig beanConfig = new BeanConfig();
    //beanConfig.setConfigId("configId: " + contextId++);
    beanConfig.setTitle("Bagri REST server");
    beanConfig.setDescription("goto http://bagridb.com for more info");
    beanConfig.setContact("[email protected]");
    beanConfig.setLicense("Apache 2.0");
    beanConfig.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html");
    beanConfig.setVersion(bg_version);
    beanConfig.setSchemes(new String[] {"http", "https"});
    // TODO: get host info somehow..
    beanConfig.setHost("localhost:" + port);
    beanConfig.setBasePath("/"); // /api
    beanConfig.setResourcePackage("com.bagri.rest.service");
    beanConfig.setPrettyPrint(true);
    // force Swagger to re-scan the package mentioned above and use 
    // custom ReaderListener from that package
    beanConfig.setScan(true);
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:20,代码来源:BagriRestServer.java

示例10: configureSwagger

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
/***
 * The context path must be set before configuring swagger
 * @param environment
 */
void configureSwagger(Environment environment, String basePath) {
  environment.jersey().register(new ApiListingResource());
  environment.jersey().register(new SwaggerJsonBareService());
  environment.jersey().register(new SwaggerSerializers());
  ScannerFactory.setScanner(new DefaultJaxrsScanner());
  environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
  BeanConfig config = new BeanConfig();

  // api specific configuration
  config.setTitle("SciGraph");
  config.setVersion("1.0.1");
  config.setResourcePackage("io.scigraph.services.resources");
  config.setScan(true);
  // TODO: Fix this so the swagger client generator can work correctly
  config.setBasePath("/" + basePath);
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:21,代码来源:MainApplication.java

示例11: init

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Override
public void init(final ServletConfig config) throws ServletException {
    super.init(config);

    final BeanConfig beanConfig = loadConfig(new File("logs/swagger.properties"));
    beanConfig.setVersion("v1");
    beanConfig.setSchemes(new String[]{"http"});
    beanConfig.setBasePath("/render-ws");
    beanConfig.setResourcePackage("org.janelia.render.service");
    beanConfig.setScan(true);
    beanConfig.setPrettyPrint(true);

    // Needed to register these modules to get Swagger to use JAXB annotations
    // (see https://github.com/swagger-api/swagger-core/issues/960 for explanation)
    Json.mapper().registerModule(new JaxbAnnotationModule());
    Yaml.mapper().registerModule(new JaxbAnnotationModule());
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:18,代码来源:SwaggerBootstrapServlet.java

示例12: setupSwagger

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private void setupSwagger(HttpServer httpServer) {
  BeanConfig beanConfig = new BeanConfig();
  beanConfig.setTitle("Pinot Controller API");
  beanConfig.setDescription("APIs for accessing Pinot Controller information");
  beanConfig.setContact("https://github.com/linkedin/pinot");
  beanConfig.setVersion("1.0");
  beanConfig.setSchemes(new String[]{"http"});
  beanConfig.setBasePath(baseUri.getPath());
  beanConfig.setResourcePackage(RESOURCE_PACKAGE);
  beanConfig.setScan(true);

  CLStaticHttpHandler apiStaticHttpHandler = new CLStaticHttpHandler(ControllerAdminApiApplication.class.getClassLoader(),
      "/api/");
  // map both /api and /help to swagger docs. /api because it looks nice. /help for backward compatibility
  httpServer.getServerConfiguration().addHttpHandler(apiStaticHttpHandler, "/api");
  httpServer.getServerConfiguration().addHttpHandler(apiStaticHttpHandler, "/help");

  URL swaggerDistLocation = ControllerAdminApiApplication.class.getClassLoader()
      .getResource("META-INF/resources/webjars/swagger-ui/2.2.2/");
  CLStaticHttpHandler swaggerDist = new CLStaticHttpHandler(
      new URLClassLoader(new URL[] {swaggerDistLocation}));
  httpServer.getServerConfiguration().addHttpHandler(swaggerDist, "/swaggerui-dist/");
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:24,代码来源:ControllerAdminApiApplication.java

示例13: setupSwagger

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private void setupSwagger(HttpServer httpServer) {
  BeanConfig beanConfig = new BeanConfig();
  beanConfig.setTitle("Pinot Broker API");
  beanConfig.setDescription("APIs for accessing Pinot broker information");
  beanConfig.setContact("https://github.com/linkedin/pinot");
  beanConfig.setVersion("1.0");
  beanConfig.setSchemes(new String[]{"http"});
  beanConfig.setBasePath(baseUri.getPath());
  beanConfig.setResourcePackage(RESOURCE_PACKAGE);
  beanConfig.setScan(true);

  CLStaticHttpHandler staticHttpHandler =
      new CLStaticHttpHandler(BrokerAdminApiApplication.class.getClassLoader(), "/api/");
  // map both /api and /help to swagger docs. /api because it looks nice. /help for backward compatibility
  httpServer.getServerConfiguration().addHttpHandler(staticHttpHandler, "/api");
  httpServer.getServerConfiguration().addHttpHandler(staticHttpHandler, "/help");

  URL swaggerDistLocation =
      BrokerAdminApiApplication.class.getClassLoader().getResource("META-INF/resources/webjars/swagger-ui/2.2.2/");
  CLStaticHttpHandler swaggerDist = new CLStaticHttpHandler(new URLClassLoader(new URL[]{swaggerDistLocation}));
  httpServer.getServerConfiguration().addHttpHandler(swaggerDist, "/swaggerui-dist/");
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:23,代码来源:BrokerAdminApiApplication.java

示例14: setupSwagger

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private void setupSwagger(HttpServer httpServer) {
  BeanConfig beanConfig = new BeanConfig();
  beanConfig.setTitle("Pinot Server API");
  beanConfig.setDescription("APIs for accessing Pinot server information");
  beanConfig.setContact("https://github.com/linkedin/pinot");
  beanConfig.setVersion("1.0");
  beanConfig.setSchemes(new String[]{"http"});
  beanConfig.setBasePath(baseUri.getPath());
  beanConfig.setResourcePackage(RESOURCE_PACKAGE);
  beanConfig.setScan(true);

  CLStaticHttpHandler staticHttpHandler = new CLStaticHttpHandler(AdminApiApplication.class.getClassLoader(), "/api/");
  // map both /api and /help to swagger docs. /api because it looks nice. /help for backward compatibility
  httpServer.getServerConfiguration().addHttpHandler(staticHttpHandler, "/api");
  httpServer.getServerConfiguration().addHttpHandler(staticHttpHandler, "/help");

  URL swaggerDistLocation = AdminApiApplication.class.getClassLoader()
      .getResource("META-INF/resources/webjars/swagger-ui/2.2.2/");
  CLStaticHttpHandler swaggerDist = new CLStaticHttpHandler(
      new URLClassLoader(new URL[] {swaggerDistLocation}));
  httpServer.getServerConfiguration().addHttpHandler(swaggerDist, "/swaggerui-dist/");
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:23,代码来源:AdminApiApplication.java

示例15: registerSwagger

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@PostConstruct
private void registerSwagger() throws IOException {
    BeanConfig swaggerConfig = new BeanConfig();
    swaggerConfig.setTitle("Cloudbreak API");
    swaggerConfig.setDescription(FileReaderUtils.readFileFromClasspath("swagger/cloudbreak-introduction"));
    if (Strings.isNullOrEmpty(cbVersion)) {
        swaggerConfig.setVersion(VERSION_UNAVAILABLE);
    } else {
        swaggerConfig.setVersion(cbVersion);
    }
    swaggerConfig.setSchemes(new String[]{"http", "https"});
    swaggerConfig.setBasePath(CoreApi.API_ROOT_CONTEXT);
    swaggerConfig.setLicenseUrl("https://github.com/sequenceiq/cloudbreak/blob/master/LICENSE");
    swaggerConfig.setResourcePackage("com.sequenceiq.cloudbreak.api");
    swaggerConfig.setScan(true);
    swaggerConfig.setContact("https://hortonworks.com/contact-sales/");
    swaggerConfig.setPrettyPrint(true);
    SwaggerConfigLocator.getInstance().putConfig(SwaggerContextService.CONFIG_ID_DEFAULT, swaggerConfig);
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:20,代码来源:EndpointConfig.java


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