/** * Returns a promise for asynchronously creating a {@link JerseyServer} * * @param options * @param jerseyOptions * @return a promise for the server */ @Override public Promise<JerseyServer> createServer( @Nullable JerseyServerOptions options, @Nullable JerseyOptions jerseyOptions) { final Deferred<JerseyServer> d = when.defer(); try { JerseyServer jerseyServer = jerseyServerProvider.get(); jerseyServer.start( options, jerseyOptions, result -> { if (result.succeeded()) { d.resolve(jerseyServer); } else { d.reject(result.cause()); } }); } catch (RuntimeException e) { d.reject(e); } return d.getPromise(); }
/** * Returns a promise for asynchronously creating a {@link * com.englishtown.vertx.jersey.JerseyServer}. The promise type matches the WhenContainer * signature to facilitate parallel deployments. * * @return a promise for an empty string */ @Override public Promise<String> createServerSimple() { return createServer().then(jerseyServer -> when.resolve("")); }