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


Java BeanConfig.setHost方法代码示例

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


在下文中一共展示了BeanConfig.setHost方法的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: evaluateSwagger

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private void evaluateSwagger()
        throws Exception {
    if (!runPerServiceMode(swagger)) {
        return;
    }

    // Add swagger providers
    _environment.jersey().register(io.swagger.jaxrs.listing.ApiListingResource.class);
    _environment.jersey().register(io.swagger.jaxrs.listing.SwaggerSerializers.class);

    // Configure and initialize swagger
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("1.0");
    beanConfig.setTitle("EMO REST Resources");
    beanConfig.setSchemes(new String[] {"http"});
    beanConfig.setHost("localhost:8080");
    beanConfig.setBasePath("/");
    // add the packages that swagger should scan to pick up the resources
    beanConfig.setResourcePackage("com.bazaarvoice.emodb.web.resources");
    // this is a MUST and should be the last property - this creates a new SwaggerContextService and initialize the scanner.
    beanConfig.setScan(true);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:23,代码来源:EmoService.java

示例4: 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;
}
 
开发者ID:labsai,项目名称:EDDI,代码行数:21,代码来源:SwaggerServletContextListener.java

示例5: testReaderRead

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Test
public void testReaderRead() throws Exception {
    BeanConfig config = new BeanConfig();
    config.setHost("localhost:8080");
    config.setSchemes(new String[]{"http"});
    config.setBasePath("/api");
    RestSwaggerReader reader = new RestSwaggerReader();

    Swagger swagger = reader.read(context.getRestDefinitions(), null, config, context.getName(), new DefaultClassResolver());
    assertNotNull(swagger);

    ObjectMapper mapper = new ObjectMapper();
    mapper.enable(SerializationFeature.INDENT_OUTPUT);
    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    String json = mapper.writeValueAsString(swagger);

    log.info(json);

    assertFalse(json.contains("\"/hello/bye\""));
    assertFalse(json.contains("\"summary\" : \"To update the greeting message\""));
    assertTrue(json.contains("\"/hello/bye/{name}\""));
    assertFalse(json.contains("\"/hello/hi/{name}\""));

    context.stop();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:RestSwaggerReaderApiDocsOverrideTest.java

示例6: 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

示例7: 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

示例8: 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

示例9: MaprMusicApp

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
public MaprMusicApp() {
    // Configure and Initialize Swagger
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("1.0.0");
    beanConfig.setSchemes(new String[]{"http"});
    beanConfig.setHost("localhost:8080");
    beanConfig.setBasePath("/mapr-music-rest/api/1.0/");
    beanConfig.setResourcePackage("com.mapr.music.api");
    beanConfig.setScan(true);
}
 
开发者ID:mapr-demos,项目名称:mapr-music,代码行数:11,代码来源:MaprMusicApp.java

示例10: swagger2Feature

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Bean
public BeanConfig swagger2Feature() {
    final BeanConfig swagger = new BeanConfig();
    swagger.setTitle("API");
    swagger.setVersion("1.0");
    swagger.setSchemes(new String[]{"http"});
    swagger.setHost("localhost:8080");
    swagger.setBasePath("/api");
    swagger.setResourcePackage("net.unibave.usertask.resource");
    swagger.setPrettyPrint(true);
    swagger.setScan(true);
    return swagger;
}
 
开发者ID:wesleyfuchter,项目名称:user-task,代码行数:14,代码来源:JerseyConfig.java

示例11: swagger2Feature

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
@Bean
public BeanConfig swagger2Feature() {
    final BeanConfig swagger = new BeanConfig();
    swagger.setTitle("API");
    swagger.setVersion("1.0");
    swagger.setSchemes(new String[]{"http"});
    swagger.setHost("localhost:8080");
    swagger.setBasePath("/api");
    swagger.setResourcePackage("com.example.unibave.rest.resource");
    swagger.setPrettyPrint(true);
    swagger.setScan(true);
    return swagger;
}
 
开发者ID:panga,项目名称:unibave-backend,代码行数:14,代码来源:JerseyConfig.java

示例12: startRestServer

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
public static HttpServer startRestServer() {
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("1.0.0");
    beanConfig.setTitle("SlideBar REST Interface");
    beanConfig.setResourcePackage(RootResource.class.getPackage().getName());
    beanConfig.setSchemes(new String[] { "http" });
    beanConfig.setHost("localhost:5055");
    beanConfig.setScan(true);

    final ResourceConfig rc = new ResourceConfig();
    rc.packages(RootResource.class.getPackage().getName());
    rc.register(LoggingFeature.class);
    rc.register(JacksonFeature.class);
    rc.register(ApiListingResource.class);
    rc.register(SwaggerSerializers.class);
    rc.property(ServerProperties.WADL_FEATURE_DISABLE, true);

    Logger l = Logger.getLogger("org.glassfish.grizzly.http.server.HttpHandler");
    l.setLevel(Level.FINE);
    l.setUseParentHandlers(false);
    ConsoleHandler ch = new ConsoleHandler();
    ch.setLevel(Level.ALL);
    l.addHandler(ch);

    try {
        return GrizzlyHttpServerFactory.createHttpServer(new URI("http://localhost:5055"), rc);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:SlideKB,项目名称:SlideBar,代码行数:32,代码来源:MainBack.java

示例13: startServer

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
/**
 * Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
 * @return Grizzly HTTP server.
 */
public static HttpServer startServer(int port) {
    HashMap properties = new HashMap();

    bridgeLog();

    // create a resource config that scans for JAX-RS resources and providers
    // in io.github.javathought.devoxx package
    final ResourceConfig rc = new ResourceConfig().packages("io.github.javathought.devoxx", "org.glassfish.jersey.examples.jackson");
    rc.register(SecurityFilter.class);
    rc.register(CrossDomainFilter.class);
    rc.register(SelectableEntityFilteringFeature.class);
    rc.property(SelectableEntityFilteringFeature.QUERY_PARAM_NAME, "select");
    rc.register(JacksonFeature.class);
    rc.register(RolesAllowedDynamicFeature.class);
    rc.register(CsrfProtectionFilter.class);

    rc.register(ApiListingResource.class);
    rc.register(SwaggerSerializers.class);
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("1.0");
    beanConfig.setSchemes(new String[]{"http"});
    beanConfig.setHost("localhost:8084");
    beanConfig.setBasePath("/myapp");
    beanConfig.setResourcePackage("io.github.javathought.devoxx.resources");
    beanConfig.setPrettyPrint(true);
    beanConfig.setScan(true);
    // create and start a new instance of grizzly http server
    // exposing the Jersey application at BASE_URI
    return GrizzlyHttpServerFactory.createHttpServer(URI.create(getBaseUri(port)), rc);
}
 
开发者ID:javathought,项目名称:devoxx-2017,代码行数:35,代码来源:Main.java

示例14: Application

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
public Application() {
	super(Settings.WEB_ROOT_PACKAGE_NAME + ".jersey");
	BeanConfig beanConfig = new BeanConfig();
	beanConfig.setSchemes(new String[] { WebUtil.getHttpScheme() });
	beanConfig.setHost(WebUtil.getHttpHost());
	beanConfig.setBasePath("/" + WebUtil.REST_API_PATH);
	beanConfig.setTitle(Settings.getString(SettingCodes.API_TITLE, Bundle.SETTINGS, DefaultSettings.API_TITLE));
	// beanConfig.setDescription(Settings.getString(SettingCodes.API_INSTANCE, Bundle.SETTINGS, DefaultSettings.API_INSTANCE));
	beanConfig.setVersion(Settings.getString(SettingCodes.API_VERSION, Bundle.SETTINGS, DefaultSettings.API_VERSION));
	beanConfig.setContact(Settings.getContactEmail());
	// beanConfig.setResourcePackage("io.swagger.resources");
	beanConfig.setResourcePackage(Settings.WEB_ROOT_PACKAGE_NAME + ".jersey.resource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.shared.HyperlinkResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.course.CourseResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.inventory.InventoryResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.staff.StaffResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.shared.SearchResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.trial.VisitResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.proband.ProbandResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.inputfield.InputFieldResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.trial.VisitScheduleItemResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.user.UserResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.trial.InquiryResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.shared.FileResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.trial.ProbandListEntryResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.trial.ProbandListEntryTagResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.trial.ProbandListEntryTagValuesResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.trial.ProbandListStatusEntryResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.shared.JournalResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.proband.InquiryValuesResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.shared.IndexResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.shared.SelectionSetResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.shared.ToolsResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.inputfield.SelectionSetValueResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.trial.ProbandGroupResource");
	// beanConfig.setResourcePackage("org.phoenixctms.ctsms.web.jersey.resource.trial.TrialResource");
	beanConfig.setScan(true);
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:39,代码来源:Application.java

示例15: main

import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
public static void main(String[] args) {
    IpFinder ipFinder = new IpFinder();
    String host = ipFinder.findIp() + ":9005";

    String BASE_URI = "http://0.0.0.0:9005/elo-api/";

    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("BETA");
    beanConfig.setSchemes(new String[]{"http"});
    beanConfig.setHost("");
    beanConfig.setBasePath("/elo-api");
    beanConfig.setResourcePackage("com.github.wakingrufus.elo.api");
    beanConfig.setTitle("ELO API");
    beanConfig.setScan(true);

    //   ServletContainer sc = new ServletContainer(new JerseyApplication());
    ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator();

    HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), new JerseyApplication(), locator);

    try {
        httpServer.start();
        CLStaticHttpHandler staticHttpHandler = new CLStaticHttpHandler(Main.class.getClassLoader(), "swagger-ui/");
        httpServer.getServerConfiguration().addHttpHandler(staticHttpHandler, "/docs");

        System.out.println(String.format("Jersey app started with WADL available at "
                + "%sapplication.wadl\nHit enter to stop it...", BASE_URI));
        System.in.read();
        // httpServer.shutdown();
    } catch (IOException e) {
        e.printStackTrace();
    }

}
 
开发者ID:wakingrufus,项目名称:elo-api,代码行数:35,代码来源:Main.java


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