Java 类org.glassfish.jersey.server.monitoring.RequestEventListener 实例源码

项目:lens    文件:LensApplicationListener.java   
/** The req listener. */

  /*
   * (non-Javadoc)
   *
   * @see
   * org.glassfish.jersey.server.monitoring.ApplicationEventListener#onRequest(org.glassfish.jersey.server.monitoring
   * .RequestEvent)
   */
  @Override
  public RequestEventListener onRequest(RequestEvent requestEvent) {
    // Request start events are sent to application listener and not request listener
    if (RequestEvent.Type.START == requestEvent.getType()) {
      MetricsService metricsSvc = LensServices.get().getService(MetricsService.NAME);
      if (metricsSvc != null) {
        metricsSvc.incrCounter(LensRequestListener.class, LensRequestListener.HTTP_REQUESTS_STARTED);
      }
    }
    return new LensRequestListener();
  }
项目:dremio-oss    文件:TimingApplicationEventListener.java   
@Override
public RequestEventListener onRequest(RequestEvent event) {
  if (Timer.enabled()) {
    return new TimingRequestEventListener(nextReqId ++);
  }
  return null;
}
项目:CredentialStorageService-dw-hibernate    文件:UnitOfWorkApplicationListenerTest.java   
private void execute() {
    this.listener.onEvent(this.appEvent);
    final RequestEventListener requestListener = this.listener
            .onRequest(this.requestStartEvent);
    requestListener.onEvent(this.requestMethodStartEvent);
    requestListener.onEvent(this.responseFiltersStartEvent);
}
项目:CredentialStorageService-dw-hibernate    文件:UnitOfWorkApplicationListenerTest.java   
private void executeWithException() {
    this.listener.onEvent(this.appEvent);
    final RequestEventListener requestListener = this.listener
            .onRequest(this.requestStartEvent);
    requestListener.onEvent(this.requestMethodStartEvent);
    requestListener.onEvent(this.requestMethodExceptionEvent);
}
项目:dropwizard-jooq    文件:JooqTransactionalApplicationListenerTest.java   
@Test
public void commitsAndClosesOnSuccessfulFinish() throws SQLException, NoSuchMethodException {
    prepareAppEvent("methodWithDefaultAnnotation");
    listener.onEvent(appEvent);
    RequestEventListener requestListener = listener.onRequest(requestStartEvent);

    when(requestFinishEvent.isSuccess()).thenReturn(true);

    requestListener.onEvent(requestFinishEvent);

    verify(connection).commit();
    verify(connection).close();
    verify(connection, never()).rollback();
}
项目:dropwizard-jooq    文件:JooqTransactionalApplicationListenerTest.java   
@Test
public void doesNotCommitOrCloseOnUnsuccessfulFinish() throws SQLException, NoSuchMethodException {
    prepareAppEvent("methodWithDefaultAnnotation");
    listener.onEvent(appEvent);
    RequestEventListener requestListener = listener.onRequest(requestStartEvent);

    when(requestFinishEvent.isSuccess()).thenReturn(false);

    requestListener.onEvent(requestFinishEvent);

    verify(connection, never()).commit();
    verify(connection, never()).close();
}
项目:dropwizard-jooq    文件:JooqTransactionalApplicationListenerTest.java   
@Test
public void rollbackAndCloseOnException() throws SQLException, NoSuchMethodException {
    prepareAppEvent("methodWithDefaultAnnotation");
    listener.onEvent(appEvent);
    RequestEventListener requestListener = listener.onRequest(requestStartEvent);

    requestListener.onEvent(requestMethodExceptionEvent);

    verify(connection).rollback();
    verify(connection).close();
    verify(connection, never()).commit();

}
项目:dropwizard-entitymanager    文件:UnitOfWorkApplicationListenerTest.java   
private void execute() {
    listener.onEvent(appEvent);
    RequestEventListener requestListener = listener.onRequest(requestStartEvent);
    requestListener.onEvent(requestMethodStartEvent);
    requestListener.onEvent(responseFiltersStartEvent);
    requestListener.onEvent(responseFinishedEvent);
}
项目:dropwizard-entitymanager    文件:UnitOfWorkApplicationListenerTest.java   
private void executeWithException() {
    listener.onEvent(appEvent);
    RequestEventListener requestListener = listener.onRequest(requestStartEvent);
    requestListener.onEvent(requestMethodStartEvent);
    requestListener.onEvent(requestMethodExceptionEvent);
    requestListener.onEvent(responseFiltersStartEvent);
    requestListener.onEvent(responseFinishedEvent);
}
项目:minnal    文件:JerseyApplicationEventListenerTest.java   
@Test
public void shouldReturnOpenSessionInViewFilterOnRequestEvent() {
    DatabaseConfiguration configuration = mock(DatabaseConfiguration.class);
    JerseyApplicationEventListener listener = new JerseyApplicationEventListener(configuration);
    RequestEvent requestEvent = mock(RequestEvent.class);
    RequestEventListener eventListener = listener.onRequest(requestEvent);
    assertTrue(eventListener instanceof OpenSessionInViewFilter);
    assertEquals(((OpenSessionInViewFilter)eventListener).getConfiguration(), configuration);
}
项目:micrometer    文件:MetricsApplicationEventListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new MetricsRequestEventListener(meterRegistry, tagsProvider, metricName, autoTimeRequests, annotationFinder);
}
项目:biblebot    文件:JerseyEndpointLoggingListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return null;
}
项目:lyre    文件:APIxListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new APIxRequestEventListener();
}
项目:jersey-2.x-webapp-for-servlet-container    文件:SampleApplicationEventListener.java   
@Override
public synchronized RequestEventListener onRequest(RequestEvent requestEvent) {
  return null;
}
项目:zefiro    文件:ExceptionListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new ExceptionRequestEventListener();
}
项目:CredentialStorageService-dw-hibernate    文件:UnitOfWorkApplicationListener.java   
@Override
public RequestEventListener onRequest(final RequestEvent event) {
    return new UnitOfWorkEventListener(this.methodMap, this.bundles);
}
项目:dropwizard-hk2    文件:ComponentActivator.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return null; // no request processing
}
项目:registry    文件:TransactionEventListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new UnitOfWorkEventListener(methodMap, transactionManager, runWithTxnIfNotConfigured);
}
项目:dropwizard-hk2bundle    文件:HK2LifecycleListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return null;
}
项目:fili    文件:QueryParameterNormalizationFilter.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    // Do nothing per request
    return null;
}
项目:minerva    文件:LoggingApplicationEventListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    requestCounter++;
    LOG.info("Request " + requestCounter + " started.");
    return new LoggingRequestEventListener(requestCounter);
}
项目:dropwizard-jooq    文件:JooqTransactionalApplicationListener.java   
@Override
public RequestEventListener onRequest(RequestEvent event) {
    return new JooqTransactionalRequestListener();
}
项目:dropwizard-entitymanager    文件:UnitOfWorkApplicationListener.java   
@Override
public RequestEventListener onRequest(RequestEvent event) {
    return new UnitOfWorkEventListener(methodMap, entityManagerFactories);
}
项目:dropwizard-circuitbreaker    文件:CircuitBreakerApplicationEventListener.java   
@Override
public RequestEventListener onRequest(final RequestEvent requestEvent) {
    return new CircuitBreakerEventListener(this, this.circuitBreaker, this.meterMap);
}
项目:restskol    文件:RestSkolApplicationEventListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new RestSkolRequestListener();
}
项目:ameba    文件:Application.java   
@Override
public RequestEventListener onRequest(org.glassfish.jersey.server.monitoring.RequestEvent requestEvent) {
    AmebaFeature.publishEvent(new RequestEvent(requestEvent));
    return event -> AmebaFeature.publishEvent(new RequestEvent(event));
}
项目:rest-utils    文件:MetricsResourceMethodApplicationListener.java   
@Override
public RequestEventListener onRequest(final RequestEvent event) {
  return new MetricsRequestEventListener(methodMetrics, time);
}
项目:jqm    文件:ExceptionLogger.java   
@Override
public RequestEventListener onRequest(final RequestEvent requestEvent)
{
    return this;
}
项目:minnal    文件:JerseyApplicationEventListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new OpenSessionInViewFilter(configuration);
}
项目:dropwizard-routing    文件:RoutingUnitOfWorkApplicationListener.java   
@Override
public RequestEventListener onRequest(RequestEvent event) {
    RequestEventListener listener = new UnitOfWorkEventListener(methodMap, sessionFactoryMap);

    return listener;
}
项目:dropwizard-routing    文件:RoutingUnitOfWorkApplicationListenerTest.java   
private void execute() {
    listener.onEvent(appEvent);
    RequestEventListener requestListener = listener.onRequest(requestStartEvent);
    requestListener.onEvent(requestMethodStartEvent);
    requestListener.onEvent(responseFiltersStartEvent);
}
项目:dropwizard-routing    文件:RoutingUnitOfWorkApplicationListenerTest.java   
private void executeWithException() {
    listener.onEvent(appEvent);
    RequestEventListener requestListener = listener.onRequest(requestStartEvent);
    requestListener.onEvent(requestMethodStartEvent);
    requestListener.onEvent(requestMethodExceptionEvent);
}
项目:anycook-api    文件:ExceptionListener.java   
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new ExceptionRequestEventListener();
}