org.glassfish.jersey.server.monitoring.RequestEvent.Type Java Examples
The following examples show how to use
org.glassfish.jersey.server.monitoring.RequestEvent.Type.
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: DefaultJerseyTagsProviderTest.java From micrometer with Apache License 2.0 | 6 votes |
private static RequestEvent event(Integer status, Exception exception, String baseUri, String... uriTemplateStrings) { Builder builder = new RequestEventImpl.Builder(); ContainerRequest containerRequest = mock(ContainerRequest.class); when(containerRequest.getMethod()).thenReturn("GET"); builder.setContainerRequest(containerRequest); ContainerResponse containerResponse = mock(ContainerResponse.class); when(containerResponse.getStatus()).thenReturn(status); builder.setContainerResponse(containerResponse); builder.setException(exception, null); ExtendedUriInfo extendedUriInfo = mock(ExtendedUriInfo.class); when(extendedUriInfo.getBaseUri()).thenReturn( URI.create("http://localhost:8080" + (baseUri == null ? "/" : baseUri))); List<UriTemplate> uriTemplates = uriTemplateStrings == null ? Collections.emptyList() : Arrays.stream(uriTemplateStrings).map(uri -> new UriTemplate(uri)) .collect(Collectors.toList()); // UriTemplate are returned in reverse order Collections.reverse(uriTemplates); when(extendedUriInfo.getMatchedTemplates()).thenReturn(uriTemplates); builder.setExtendedUriInfo(extendedUriInfo); return builder.build(Type.FINISHED); }
Example #2
Source File: ExceptionLogger.java From jqm with Apache License 2.0 | 5 votes |
@Override public void onEvent(RequestEvent paramRequestEvent) { if (paramRequestEvent.getType() == Type.ON_EXCEPTION) { log.info("a REST call failed with an exception", paramRequestEvent.getException()); } }
Example #3
Source File: RequestEvent.java From ameba with MIT License | 2 votes |
/** * <p>getType.</p> * * @return a {@link org.glassfish.jersey.server.monitoring.RequestEvent.Type} object. */ public Type getType() { return event.getType(); }