本文整理汇总了Java中io.swagger.jaxrs.listing.SwaggerSerializers类的典型用法代码示例。如果您正苦于以下问题:Java SwaggerSerializers类的具体用法?Java SwaggerSerializers怎么用?Java SwaggerSerializers使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SwaggerSerializers类属于io.swagger.jaxrs.listing包,在下文中一共展示了SwaggerSerializers类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: customize
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
@Override
public void customize(ResteasyConfig config) {
if (configurationProperties.isEnabled()) {
// Serializers
if (!config.isRegistered(SwaggerSerializers.class)) {
config.register(SwaggerSerializers.class);
}
// check configuration
if (configurationProperties.isPrettyPrint()) {
SwaggerSerializers.setPrettyPrint(true);
}
// API listings
final List<ApiListingDefinition> definitions = SwaggerJaxrsUtils
.getApiListings(configurationProperties);
for (ApiListingDefinition definition : definitions) {
definition.configureEndpoints(classLoader, apiPath).forEach(e -> {
config.register(e.getResourceClass());
LOGGER.info("[Resteasy] [" + e.getGroupId() + "] Swagger API listing configured - Path: "
+ SwaggerJaxrsUtils.composePath(apiPath, e.getPath()));
});
}
}
}
示例2: customize
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
@Override
public void customize(ResourceConfig config) {
if (configurationProperties.isEnabled()) {
// Serializers
if (!config.isRegistered(SwaggerSerializers.class)) {
config.register(SwaggerSerializers.class, Integer.MIN_VALUE - 100);
}
// check configuration
if (configurationProperties.isPrettyPrint()) {
SwaggerSerializers.setPrettyPrint(true);
}
// API listings
final List<ApiListingDefinition> definitions = SwaggerJaxrsUtils.getApiListings(configurationProperties);
for (ApiListingDefinition definition : definitions) {
definition.configureEndpoints(classLoader, apiPath).forEach(e -> {
config.register(e.getResourceClass());
LOGGER.info("[Jersey] [" + e.getGroupId() + "] Swagger API listing configured - Path: "
+ SwaggerJaxrsUtils.composePath(apiPath, e.getPath()));
});
}
}
}
示例3: RESTConfig
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的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);
}
示例4: BaseApplicaionConfig
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
public BaseApplicaionConfig() {
//设置默认时区
System.setProperty("user.timezone", "Asia/Shanghai");
register(ValidationContextResolver.class);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true);
this.packages(packages());
register(ObjectMapperResolver.class);
register(JacksonFeature.class);
register(JacksonJsonProvider.class);
register(new BaseExceptionMapper(createExcetionWrapper()));
register(RequestContextFilter.class);
register(DefaultWebFilter.class);
if (FilterConfig.apiDocEnabled()) {
register(SwaggerSerializers.class);
}
}
示例5: configureSwagger
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的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);
}
示例6: BaseApplicaionConfig
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
public BaseApplicaionConfig() {
//设置默认时区
System.setProperty("user.timezone","Asia/Shanghai");
register(ValidationContextResolver.class);
property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true);
property(ServerProperties.BV_DISABLE_VALIDATE_ON_EXECUTABLE_OVERRIDE_CHECK, true);
this.packages(packages());
register(ObjectMapperResolver.class);
register(JacksonFeature.class);
register(JacksonJsonProvider.class);
register(new BaseExceptionMapper(createExcetionWrapper()));
register(RequestContextFilter.class);
register(DefaultWebFilter.class);
//
if(FilterConfig.apiDocEnabled()){
register(SwaggerSerializers.class);
}
}
示例7: Main
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
private Main() {
packages("us.askplatyp.kb.lucene.http");
register(JacksonFeature.class);
register(EntityFilteringFeature.class);
register(new AbstractBinder() {
@Override
protected void configure() {
bindFactory(WikidataLuceneIndexFactory.class).to(LuceneIndex.class);
}
});
register(CORSFilter.class);
register(ApiListingResource.class);
register(SwaggerSerializers.class);
EncodingFilter.enableFor(this, GZipEncoder.class);
EncodingFilter.enableFor(this, DeflateEncoder.class);
configureSwagger();
}
示例8: run
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
@Override
public void run(C configuration, Environment environment) throws Exception {
this.configuration = configuration;
this.environment = environment;
run(configuration, µsBundleInstance.µsEnvironment(this.environment));
if (configuration instanceof ZipkinAware) {
Brave brave = ((ZipkinAware)configuration).getZipkin().build(environment);
}
configureMapper(configuration, environment.getObjectMapper());
if (configuration instanceof ValidatorAware) {
environment.jersey().register(ValidationResource.class);
}
if (configuration instanceof SwaggerAware) {
environment.jersey().register(SwaggerSerializers.class);
environment.jersey().register(ApiListingResource.class);
environment.jersey().register(AcceptHeaderApiListingResource.class);
}
}
示例9: ApplicationConfig
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
public ApplicationConfig(){
register(AccessControlExceptionMapper.class);
register(AppExceptionMapper.class);
register(AuthExceptionMapper.class);
register(ThrowableExceptionMapper.class);
register(TransactionExceptionMapper.class);
//API V2
//Projects & Datasets
//register(ProjectAuthFilter.class);
register(ProjectsResource.class);
register(DatasetsResource.class);
register(MembersResource.class);
register(BlobsResource.class);
register(PathValidator.class);
//Hopsworks-Users
register(UsersResource.class);
//swagger
register(ApiListingResource.class);
register(SwaggerSerializers.class);
}
示例10: OntoSoftServer
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
public OntoSoftServer() {
// Headers
register(AcceptHeaderFilter.class);
register(CORSResponseFilter.class);
// User roles and authentication
register(RolesAllowedDynamicFeature.class);
register(UserAuthenticationFilter.class);
// Main Resources
register(UserResource.class);
register(SoftwareResource.class);
// OpenAPI documentation
register(ApiListingResource.class);
register(SwaggerSerializers.class);
initializeSwagger();
}
示例11: buildConfig
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
public ResourceConfig buildConfig() {
ResourceConfig config = new ResourceConfig(AccessService.class, CollectionService.class, DocumentService.class,
QueryService.class, SchemaService.class, TransactionService.class);
config.register(this);
config.register(AuthFilter.class);
config.register(JacksonFeature.class);
config.register(new AbstractBinder() {
@Override
protected void configure() {
bindFactory(BagriRestServer.this).to(RepositoryProvider.class);
}
});
config.register(WadlFeature.class);
config.registerInstances(reloader);
// adding Swagger support
config.register(ApiListingResource.class);
config.register(SwaggerSerializers.class);
return config;
}
示例12: configureSwagger
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的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);
}
示例13: bindSwagger
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的package包/类
private void bindSwagger() {
BeanConfig beanConfig = new BeanConfig();
beanConfig.setBasePath("/");
beanConfig.setResourcePackage(API_PACKAGE);
beanConfig.setScan(true);
SwaggerModelTransformer transformer = SwaggerModelTransformer.builder()
.addTransformation(new ResultContainerTransformation(ResultStash.class, "data"))
.build();
bind(SwaggerApiListingResource.class).in(Scopes.SINGLETON);
bind(SwaggerSerializers.class).in(Scopes.SINGLETON);
bind(SwaggerModelTransformer.class).toInstance(transformer);
}
示例14: startRestServer
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的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;
}
}
示例15: configureSwagger
import io.swagger.jaxrs.listing.SwaggerSerializers; //导入依赖的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);
}