Tabnine Logo
com.englishtown.vertx.jersey.inject
Code IndexAdd Tabnine to your IDE (free)

How to use com.englishtown.vertx.jersey.inject

Best Java code snippets using com.englishtown.vertx.jersey.inject (Showing top 20 results out of 315)

origin: ef-labs/vertx-jersey

/**
 * Returns a promise for asynchronously creating a {@link com.englishtown.vertx.jersey.JerseyServer}
 *
 * @return a promise for the server
 */
Promise<JerseyServer> createServer(@Nullable JerseyServerOptions options, @Nullable JerseyOptions jerseyOptions);
origin: com.englishtown/vertx-mod-jersey

protected void callVertxRequestProcessor(
    int index,
    final HttpServerRequest vertxRequest,
    final ContainerRequest jerseyRequest,
    final Handler<Void> done
) {
  if (index >= requestProcessors.size()) {
    done.handle(null);
  }
  VertxRequestProcessor processor = requestProcessors.get(index);
  final int next = index + 1;
  processor.process(vertxRequest, jerseyRequest, new Handler<Void>() {
    @Override
    public void handle(Void aVoid) {
      if (next >= requestProcessors.size()) {
        done.handle(null);
      } else {
        callVertxRequestProcessor(next, vertxRequest, jerseyRequest, done);
      }
    }
  });
}
origin: com.englishtown.vertx/vertx-jersey

protected void end() {
  // End the vertx response
  vertxRequest.response().end();
  // Call any post response processors
  if (!postResponseProcessors.isEmpty()) {
    for (VertxPostResponseProcessor processor : postResponseProcessors) {
      processor.process(vertxRequest.response(), jerseyResponse);
    }
  }
}
origin: com.englishtown/vertx-mod-jersey

  /**
   * Implement to provide binding definitions using the exposed binding
   * methods.
   */
  @Override
  protected void configure() {

    // Bind the vertx and container instances
    bind(vertx).to(Vertx.class);
    bind(container).to(Container.class);

    // Request and read stream
    bindFactory(VertxRequestReferencingFactory.class).to(HttpServerRequest.class).in(PerLookup.class);
    bindFactory(VertxRequestReferencingFactory.class).to(new TypeLiteral<ReadStream<HttpServerRequest>>() {
    }).in(PerLookup.class);
    bindFactory(ReferencingFactory.<HttpServerRequest>referenceFactory()).to(new TypeLiteral<Ref<HttpServerRequest>>() {
    }).in(RequestScoped.class);

    // Response
    bindFactory(VertxResponseReferencingFactory.class).to(HttpServerResponse.class).in(PerLookup.class);
    bindFactory(ReferencingFactory.<HttpServerResponse>referenceFactory()).to(new TypeLiteral<Ref<HttpServerResponse>>() {
    }).in(RequestScoped.class);

  }
}
origin: ef-labs/vertx-jersey

@Test
public void testConfigure() throws Exception {
  InternalVertxJerseyBinder binder = new InternalVertxJerseyBinder(mock(Vertx.class));
  DynamicConfiguration dynamicConfiguration = mock(DynamicConfiguration.class);
  binder.bind(dynamicConfiguration);
}
origin: com.englishtown.vertx/vertx-jersey

rc.register(new InternalVertxJerseyBinder(vertx));
origin: com.englishtown.vertx/vertx-jersey

  /**
   * Implement to provide binding definitions using the exposed binding
   * methods.
   */
  @Override
  protected void configure() {

    // Bind the vertx and container instances
    bind(vertx).to(Vertx.class);

    // Request and read stream
    bindFactory(VertxRequestReferencingFactory.class).to(HttpServerRequest.class).in(PerLookup.class);
    bindFactory(VertxRequestReferencingFactory.class).to(new TypeLiteral<ReadStream<HttpServerRequest>>() {
    }).in(PerLookup.class);
    bindFactory(ReferencingFactory.<HttpServerRequest>referenceFactory()).to(new TypeLiteral<Ref<HttpServerRequest>>() {
    }).in(RequestScoped.class);

    // Response
    bindFactory(VertxResponseReferencingFactory.class).to(HttpServerResponse.class).in(PerLookup.class);
    bindFactory(ReferencingFactory.<HttpServerResponse>referenceFactory()).to(new TypeLiteral<Ref<HttpServerResponse>>() {
    }).in(RequestScoped.class);

  }
}
origin: ef-labs/vertx-jersey

protected void end() {
  // End the vertx response
  vertxRequest.response().end();
  // Call any post response processors
  if (!postResponseProcessors.isEmpty()) {
    for (VertxPostResponseProcessor processor : postResponseProcessors) {
      processor.process(vertxRequest.response(), jerseyResponse);
    }
  }
}
origin: ef-labs/vertx-jersey

@Test
public void testHandle_RequestProcessors() throws Exception {
  when(request.headers()).thenReturn(mock(MultiMap.class));
  when(request.method()).thenReturn(HttpMethod.GET);
  InputStream inputStream = null;
  VertxRequestProcessor rp1 = mock(VertxRequestProcessor.class);
  VertxRequestProcessor rp2 = mock(VertxRequestProcessor.class);
  requestProcessors.add(rp1);
  requestProcessors.add(rp2);
  jerseyHandler.handle(request, inputStream);
  verify(rp1).process(any(HttpServerRequest.class), any(ContainerRequest.class), endHandlerCaptor.capture());
  endHandlerCaptor.getValue().handle(null);
  verify(rp2).process(any(HttpServerRequest.class), any(ContainerRequest.class), endHandlerCaptor.capture());
  endHandlerCaptor.getValue().handle(null);
  verify(applicationHandlerDelegate).handle(any(ContainerRequest.class));
}
origin: ef-labs/vertx-jersey

rc.register(new InternalVertxJerseyBinder(vertx));
origin: com.englishtown.vertx/vertx-jersey

/**
 * Returns a promise for asynchronously creating a {@link com.englishtown.vertx.jersey.JerseyServer}
 *
 * @return a promise for the server
 */
Promise<JerseyServer> createServer(@Nullable JerseyServerOptions options, @Nullable JerseyOptions jerseyOptions);
origin: ef-labs/vertx-jersey

  /**
   * Implement to provide binding definitions using the exposed binding
   * methods.
   */
  @Override
  protected void configure() {

    // Bind the vertx and container instances
    bind(vertx).to(Vertx.class);

    // Request and read stream
    bindFactory(VertxRequestReferencingFactory.class).to(HttpServerRequest.class).in(PerLookup.class);
    bindFactory(VertxRequestReferencingFactory.class).to(new TypeLiteral<ReadStream<HttpServerRequest>>() {
    }).in(PerLookup.class);
    bindFactory(ReferencingFactory.<HttpServerRequest>referenceFactory()).to(new TypeLiteral<Ref<HttpServerRequest>>() {
    }).in(RequestScoped.class);

    // Response
    bindFactory(VertxResponseReferencingFactory.class).to(HttpServerResponse.class).in(PerLookup.class);
    bindFactory(ReferencingFactory.<HttpServerResponse>referenceFactory()).to(new TypeLiteral<Ref<HttpServerResponse>>() {
    }).in(RequestScoped.class);

  }
}
origin: com.englishtown/vertx-mod-jersey

protected void end() {
  // End the vertx response
  vertxRequest.response().end();
  // Call any post response processors
  if (!postResponseProcessors.isEmpty()) {
    for (VertxPostResponseProcessor processor : postResponseProcessors) {
      processor.process(vertxRequest.response(), jerseyResponse);
    }
  }
}
origin: com.englishtown.vertx/vertx-jersey

/**
 * Creates a vert.x {@link HttpServer} with a jersey handler
 *
 * @param doneHandler the optional callback for when initialization has completed
 */
default void start(@Nullable Handler<AsyncResult<HttpServer>> doneHandler) {
  start(null, null, doneHandler);
}
origin: ef-labs/vertx-jersey

@Test
public void testCommit() throws Exception {
  VertxPostResponseProcessor processor1 = mock(VertxPostResponseProcessor.class);
  VertxPostResponseProcessor processor2 = mock(VertxPostResponseProcessor.class);
  postResponseProcessors.add(processor1);
  postResponseProcessors.add(processor2);
  writer.commit();
  verify(response).end();
  verify(processor1).process(eq(response), any(ContainerResponse.class));
  verify(processor2).process(eq(response), any(ContainerResponse.class));
}
origin: ef-labs/vertx-jersey

/**
 * Creates a vert.x {@link HttpServer} with a jersey handler
 *
 * @param doneHandler the optional callback for when initialization has completed
 */
default void start(@Nullable Handler<AsyncResult<HttpServer>> doneHandler) {
  start(null, null, doneHandler);
}
origin: ef-labs/vertx-jersey

@Inject
public DefaultVertxContainer(Vertx vertx, JerseyOptions options, @Optional @Nullable ServiceLocator locator, @Optional @Nullable ApplicationConfigurator configurator) {
  this.vertx = vertx;
  this.options = options;
  this.locator = locator;
  this.configurator = configurator;
}
origin: com.englishtown.vertx/vertx-jersey

@Inject
public DefaultVertxContainer(Vertx vertx, JerseyOptions options, @Optional @Nullable ServiceLocator locator, @Optional @Nullable ApplicationConfigurator configurator) {
  this.vertx = vertx;
  this.options = options;
  this.locator = locator;
  this.configurator = configurator;
}
origin: ef-labs/vertx-jersey

/**
 * 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();
}
origin: com.englishtown.vertx/vertx-jersey

/**
 * 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();
}
com.englishtown.vertx.jersey.inject

Most used classes

  • ContainerResponseWriterProvider
    Injectable interface to provide the Jersey ContainerResponseWriter instance for the current request
  • InternalVertxJerseyBinder
    HK2 binder to configure the minimum interfaces required for the com.englishtown.vertx.jersey.JerseyM
  • VertxPostResponseProcessor
    Injectable interface to provide additional processing after the vert.x response has ended.
  • VertxRequestProcessor
    Injectable interface to provide additional async vert.x request processing before Jersey
  • VertxResponseProcessor
    Injectable interface to provide additional vert.x response processing after Jersey.
  • VertxResponseWriterProvider
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now