org.glassfish.jersey.server.monitoring.RequestEventListener Java Examples

The following examples show how to use org.glassfish.jersey.server.monitoring.RequestEventListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpanCustomizingApplicationEventListenerTest.java    From wingtips with Apache License 2.0 6 votes vote down vote up
@Test
public void onRequest_retunrs_self_for_START_otherwise_null() {
    for (RequestEvent.Type type : RequestEvent.Type.values()) {
        // given
        doReturn(type).when(requestEventMock).getType();
        boolean expectNonNullResult = (type == RequestEvent.Type.START);

        // when
        RequestEventListener result = implSpy.onRequest(requestEventMock);

        // then
        if (expectNonNullResult) {
            assertThat(result).isSameAs(implSpy);
        }
        else {
            assertThat(result).isNull();
        }
    }
}
 
Example #2
Source File: JerseyApplicationEventListenerTest.java    From minnal with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #3
Source File: TimingApplicationEventListener.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public RequestEventListener onRequest(RequestEvent event) {
  if (Timer.enabled()) {
    return new TimingRequestEventListener(nextReqId ++);
  }
  return null;
}
 
Example #4
Source File: SpanCustomizingApplicationEventListener.java    From wingtips with Apache License 2.0 5 votes vote down vote up
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    if (requestEvent.getType() == RequestEvent.Type.START) {
        return this;
    }

    return null;
}
 
Example #5
Source File: OpenCensusApplicationEventListener.java    From heroic with Apache License 2.0 5 votes vote down vote up
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    if (requestEvent.getType() == RequestEvent.Type.START) {
        Span requestSpan = handleRequestStart(requestEvent.getContainerRequest());
        return new OpenCensusRequestEventListener(requestSpan);
    }
    return null;
}
 
Example #6
Source File: TracingApplicationEventListener.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public RequestEventListener onRequest(RequestEvent event) {
  if (event.getType() != RequestEvent.Type.START) return null;
  Span span = handler.handleReceive(new ContainerRequestWrapper(event.getContainerRequest()));
  return new TracingRequestEventListener(span, currentTraceContext.newScope(span.context()));
}
 
Example #7
Source File: JerseyEventListener.java    From metrics with Apache License 2.0 4 votes vote down vote up
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    requestCnt.incrementAndGet();
    return null;
}
 
Example #8
Source File: SpanCustomizingApplicationEventListener.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override public RequestEventListener onRequest(RequestEvent requestEvent) {
  if (requestEvent.getType() == RequestEvent.Type.START) return this;
  return null;
}
 
Example #9
Source File: JerseyApplicationEventListener.java    From minnal with Apache License 2.0 4 votes vote down vote up
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
	return new OpenSessionInViewFilter(configuration);
}
 
Example #10
Source File: ExceptionLogger.java    From jqm with Apache License 2.0 4 votes vote down vote up
@Override
public RequestEventListener onRequest(final RequestEvent requestEvent)
{
    return this;
}
 
Example #11
Source File: MetricsResourceMethodApplicationListener.java    From rest-utils with Apache License 2.0 4 votes vote down vote up
@Override
public RequestEventListener onRequest(final RequestEvent event) {
  return new MetricsRequestEventListener(methodMetrics, time);
}
 
Example #12
Source File: Application.java    From ameba with MIT License 4 votes vote down vote up
@Override
public RequestEventListener onRequest(org.glassfish.jersey.server.monitoring.RequestEvent requestEvent) {
    AmebaFeature.publishEvent(new RequestEvent(requestEvent));
    return event -> AmebaFeature.publishEvent(new RequestEvent(event));
}
 
Example #13
Source File: LifecycleDiagnostic.java    From dropwizard-guicey with MIT License 4 votes vote down vote up
@Override
public RequestEventListener onRequest(final RequestEvent requestEvent) {
    return null;
}
 
Example #14
Source File: TransactionEventListener.java    From registry with Apache License 2.0 4 votes vote down vote up
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new UnitOfWorkEventListener(methodMap, transactionManager, runWithTxnIfNotConfigured, defaultTransactionIsolation);
}
 
Example #15
Source File: MetricsApplicationEventListener.java    From micrometer with Apache License 2.0 4 votes vote down vote up
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new MetricsRequestEventListener(meterRegistry, tagsProvider, metricName, autoTimeRequests, annotationFinder);
}
 
Example #16
Source File: App.java    From jweb-cms with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return requestEventListener;
}
 
Example #17
Source File: SFRestApiListener.java    From sailfish-core with Apache License 2.0 4 votes vote down vote up
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
    return new MyRequestEventListener();
}