use of io.swagger.jaxrs.config.BeanConfig in project ff4j by ff4j.
the class FF4jApiApplicationJersey2x method init.
/**
* Initialisation of Jersey2 application.
*
* @param serviceLocator
*/
public void init() {
packages(FF4jResource.class.getPackage().getName());
register(new FF4jBinder());
register(JerseyApplicationEventListener.class);
register(JerseyRequestEventListener.class);
apiConfig = getWebApiConfiguration();
if (apiConfig != null) {
if (apiConfig.isAutorize()) {
enableAuthenticationFilter();
enableAuthorizationFilter();
} else if (apiConfig.isAuthenticate()) {
enableAuthenticationFilter();
} else {
log.info("No authentication nor authorization");
}
// Swagger configuration
if (apiConfig.isDocumentation()) {
BeanConfig beanConfig = new BeanConfig();
beanConfig.setTitle("FF4J (ff4j.org) WebAPI");
beanConfig.setDescription("Administrate and operate all tasks on your features through this api");
beanConfig.setResourcePackage("org.ff4j.web.api.resources");
beanConfig.setContact("@clunven");
beanConfig.setLicense("Apache 2.0");
beanConfig.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html");
beanConfig.setVersion(apiConfig.getVersion());
beanConfig.setSchemes(new String[] { "http" });
beanConfig.setHost(apiConfig.getHost() + ":" + apiConfig.getPort());
beanConfig.setBasePath("/" + apiConfig.getWebContext() + "/api");
beanConfig.setScan(true);
ScannerFactory.setScanner(beanConfig);
register(io.swagger.jaxrs.listing.ApiListingResource.class);
register(io.swagger.jaxrs.listing.SwaggerSerializers.class);
log.info("Initialisation Swagger [OK]");
}
} else {
}
log.info("Initialisation WebAPI [OK]");
}
Aggregations