本文整理汇总了Java中io.swagger.jaxrs.config.BeanConfig.setPrettyPrint方法的典型用法代码示例。如果您正苦于以下问题:Java BeanConfig.setPrettyPrint方法的具体用法?Java BeanConfig.setPrettyPrint怎么用?Java BeanConfig.setPrettyPrint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.jaxrs.config.BeanConfig
的用法示例。
在下文中一共展示了BeanConfig.setPrettyPrint方法的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);
}
示例2: 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);
}
示例3: 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);
}
示例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;
}
示例5: 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);
}
示例6: 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());
}
示例7: 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);
}
示例8: 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;
}
示例9: CommsRouterApplication
import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
public CommsRouterApplication(@Context ServletContext servletContext)
throws CommsRouterException {
ApplicationContext applicationContext =
(ApplicationContext) servletContext.getAttribute(WebServletListener.APPLICATION_CONTEXT);
ManifestConfigurationImpl manifest = applicationContext.getManifest();
LOGGER.info("Build info for {}; Version: {}-{}; Build at {}; Build on JDK {}",
manifest.getImplementationTitle(),
manifest.getImplementationVersion(),
manifest.getImplementationBuild(),
manifest.getImplementationBuildTime(),
manifest.getBuildJdk());
register(new ApplicationBindings(applicationContext.getCoreContext()));
packages(CommsRouterApplication.class.getPackage().getName());
register(io.swagger.jaxrs.listing.ApiListingResource.class);
register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setSchemes(new String[] {"https","http"});
beanConfig.setBasePath(servletContext.getContextPath() + "/api");
beanConfig.setResourcePackage("com.softavail.commsrouter.webservice.resources");
beanConfig.setScan(true);
beanConfig.setPrettyPrint(true);
LOGGER.debug("Application started!");
}
示例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("com.example.unibave.rest.resource");
swagger.setPrettyPrint(true);
swagger.setScan(true);
return swagger;
}
示例11: configureSwagger
import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private void configureSwagger() {
register(ApiListingResource.class);
register(SwaggerSerializers.class);
// Just setup the configuration of the swagger API
BeanConfig config = new BeanConfig();
config.setConfigId("AcmeAire-BookingService");
config.setTitle("AcmeAire + BookingService ");
config.setVersion("v1");
config.setSchemes(new String[] {"http"});
config.setBasePath(apiPath);
config.setResourcePackage("com.acmeair");
config.setPrettyPrint(true);
config.setScan(true);
}
示例12: configureSwagger
import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private void configureSwagger() {
register(ApiListingResource.class);
register(SwaggerSerializers.class);
// Just setup the configuration of the swagger API
BeanConfig config = new BeanConfig();
config.setConfigId("AcmeAire-CustomerService");
config.setTitle("AcmeAire + CustomerService ");
config.setVersion("v1");
config.setSchemes(new String[]{"http"});
config.setBasePath(apiPath);
config.setResourcePackage("com.acmeair");
config.setPrettyPrint(true);
config.setScan(true);
}
示例13: setUpSwagger
import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
private void setUpSwagger() {
BeanConfig beanConfig = new BeanConfig();
beanConfig.setTitle("Sample Jersey 2.x RESTful Web Application");
beanConfig.setDescription(
"Sample Jersey 2.x Web Application that can be deployed in a Servlet Container"
);
beanConfig.setLicense("Unlicense");
beanConfig.setLicenseUrl("http://unlicense.org");
beanConfig.setVersion("1.0.0");
beanConfig.setSchemes(new String[]{"http"});
beanConfig.setBasePath("api");
beanConfig.setResourcePackage("com.programmingskillz.samplejerseywebapp.web");
beanConfig.setScan(true);
beanConfig.setPrettyPrint(true);
}
示例14: 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);
}
示例15: JaxRsActivator
import io.swagger.jaxrs.config.BeanConfig; //导入方法依赖的package包/类
public JaxRsActivator() {
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.0");
beanConfig.setSchemes(new String[] { "http" });
beanConfig.setTitle("Hola microservices REST API");
beanConfig.setDescription("Operations that can be invoked in the hola microservices");
beanConfig.setResourcePackage("com.redhat.developers.msa.hola");
beanConfig.setLicense("Apache 2.0");
beanConfig.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html");
beanConfig.setContact("[email protected]");
beanConfig.setBasePath("/api");
beanConfig.setPrettyPrint(true);
beanConfig.setScan(true);
}