コード例 #1
0
 /**
  * Create a new resource model builder for the introspected class.
  *
  * <p>The model returned is filled with the introspected data.
  *
  * @return new resource model builder for the introspected class.
  */
 public Resource.Builder createResourceBuilder() {
   return Errors.processWithException(
       new Producer<Resource.Builder>() {
         @Override
         public Resource.Builder call() {
           return doCreateResourceBuilder();
         }
       });
 }
コード例 #2
0
  /**
   * Create a new Jersey server-side application handler configured by a {@link Application JAX-RS
   * Application (sub-)class}.
   *
   * @param jaxrsApplicationClass JAX-RS {@code Application} (sub-)class that will be instantiated
   *     and used to configure the new Jersey application handler.
   */
  public ApplicationHandler(Class<? extends Application> jaxrsApplicationClass) {
    this.locator = Injections.createLocator(new ServerBinder(), new ApplicationBinder());
    this.application = createApplication(jaxrsApplicationClass);
    this.runtimeConfig = ResourceConfig.createRuntimeConfig(application);

    Errors.processWithException(
        new Runnable() {
          @Override
          public void run() {
            initialize();
          }
        });
  }
コード例 #3
0
  /**
   * Create a new Jersey server-side application handler configured by an instance of a {@link
   * Application JAX-RS Application sub-class}.
   *
   * @param application an instance of a JAX-RS {@code Application} (sub-)class that will be used to
   *     configure the new Jersey application handler.
   */
  public ApplicationHandler(Application application) {
    this.locator = Injections.createLocator(new ServerBinder(), new ApplicationBinder());
    this.application = application;
    if (application instanceof ResourceConfig) {
      final ResourceConfig rc = (ResourceConfig) application;
      if (rc.getApplicationClass() != null) {
        rc.setApplication(createApplication(rc.getApplicationClass()));
      }
    }
    this.runtimeConfig = ResourceConfig.createRuntimeConfig(application);

    Errors.processWithException(
        new Runnable() {
          @Override
          public void run() {
            initialize();
          }
        });
  }