Esempio n. 1
0
  public RESTApp() {
    packages("restaurant.vs.rest");
    // swagger

    register(io.swagger.jaxrs.listing.ApiListingResource.class);
    register(io.swagger.jaxrs.listing.SwaggerSerializers.class);

    BeanConfig config = new BeanConfig();
    config.setBasePath("/RestaurantRESTApp/vs");
    config.setDescription("REST API Demo");
    config.setVersion("1.0");
    config.setSchemes(new String[] {"http"});
    config.setResourcePackage("restaurant.vs");
    config.setTitle("RestaurantRESTApp");
    config.setScan(true);
  }
  public RestApplication() {

    packages("pl.edu.amu.rest");
    packages("io.swagger.jaxrs.listing");

    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("1.0.2");
    beanConfig.setSchemes(new String[] {"http"});
    beanConfig.setHost("localhost:8080");
    beanConfig.setBasePath("/");
    beanConfig.setResourcePackage("pl.edu.amu.rest");
    beanConfig.setScan(true);
  }
Esempio n. 3
0
 private void configureSwagger() {
   BeanConfig config =
       new BeanConfig() {
         @Override
         public Swagger configure(Swagger swagger) {
           Swagger configure = super.configure(swagger);
           configure.securityDefinition("auth_name", new BasicAuthDefinition());
           return configure;
         }
       };
   config.setVersion("1.0");
   config.setResourcePackage("br.ufsc.myfood.application.core");
   config.setBasePath("/app");
   config.setDescription("Restaurante MyFood");
   config.setTitle("Restaurante MyFood");
   config.setScan(true);
   config.setSchemes(new String[] {"http"});
 }
Esempio n. 4
0
  public ApplicationConfig() {
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setTitle("Photonic3D REST API");
    beanConfig.setVersion("0.0." + HostProperties.Instance().getVersionNumber());
    beanConfig.setSchemes(new String[] {"http"});
    // beanConfig.setHost("localhost:9091");
    beanConfig.setBasePath("/services");
    beanConfig.setResourcePackage("org.area515.resinprinter.services");
    beanConfig.setScan(true);
    beanConfig.setPrettyPrint(true);

    singletons.add(buildJacksonJaxbJsonProvider());
    singletons.add(new ExceptionMarshaller());
    singletons.add(PrintableService.INSTANCE);
    singletons.add(MachineService.INSTANCE);
    singletons.add(SettingsService.INSTANCE);
    singletons.add(PrinterService.INSTANCE);
    singletons.add(PrintJobService.INSTANCE);
    singletons.add(MediaService.INSTANCE);
    singletons.add(CustomizerService.INSTANCE);
    singletons.add(UserService.INSTANCE);
    singletons.add(RemoteService.INSTANCE);
  }
Esempio n. 5
0
  /**
   * Read the REST-DSL definition's and parse that as a Swagger model representation
   *
   * @param rests the rest-dsl
   * @param route optional route path to filter the rest-dsl to only include from the chose route
   * @param config the swagger configuration
   * @param classResolver class resolver to use
   * @return the swagger model
   */
  public Swagger read(
      List<RestDefinition> rests,
      String route,
      BeanConfig config,
      String camelContextId,
      ClassResolver classResolver) {
    Swagger swagger = new Swagger();

    for (RestDefinition rest : rests) {

      if (ObjectHelper.isNotEmpty(route) && !route.equals("/")) {
        // filter by route
        if (!rest.getPath().equals(route)) {
          continue;
        }
      }

      parse(swagger, rest, camelContextId, classResolver);
    }

    // configure before returning
    swagger = config.configure(swagger);
    return swagger;
  }