private void release(final ContainerResponse responseContext) { try { processingContext.closeableService().close(); // Commit the container response writer if not in chunked mode // responseContext may be null in case the request processing was cancelled. if (responseContext != null && !responseContext.isChunked()) { // responseContext.commitStream(); responseContext.close(); } } catch (final Throwable throwable) { LOGGER.log(Level.WARNING, LocalizationMessages.RELEASING_REQUEST_PROCESSING_RESOURCES_FAILED(), throwable); } finally { runtime.externalRequestScope.close(); processingContext.triggerEvent(RequestEvent.Type.FINISHED); } } }
private Response invoke(final RequestProcessingContext context, final Object resource) { context.triggerEvent(RequestEvent.Type.RESOURCE_METHOD_START); jaxrsResponse = dispatcher.dispatch(resource, context.request()); } finally { context.triggerEvent(RequestEvent.Type.RESOURCE_METHOD_FINISHED);
private Response invoke(final RequestProcessingContext context, final Object resource) { context.triggerEvent(RequestEvent.Type.RESOURCE_METHOD_START); jaxrsResponse = dispatcher.dispatch(resource, context.request()); } finally { context.triggerEvent(RequestEvent.Type.RESOURCE_METHOD_FINISHED);
private void release(final ContainerResponse responseContext) { try { processingContext.closeableService().close(); // Commit the container response writer if not in chunked mode // responseContext may be null in case the request processing was cancelled. if (responseContext != null && !responseContext.isChunked()) { // responseContext.commitStream(); responseContext.close(); } } catch (final Throwable throwable) { LOGGER.log(Level.WARNING, LocalizationMessages.RELEASING_REQUEST_PROCESSING_RESOURCES_FAILED(), throwable); } finally { runtime.externalRequestScope.close(); processingContext.triggerEvent(RequestEvent.Type.FINISHED); } } }
if (mapper != null) { processingContext.monitoringEventBuilder().setExceptionMapper(mapper); processingContext.triggerEvent(RequestEvent.Type.EXCEPTION_MAPPER_FOUND); try { final Response mappedResponse = mapper.toResponse(throwable);
if (mapper != null) { processingContext.monitoringEventBuilder().setExceptionMapper(mapper); processingContext.triggerEvent(RequestEvent.Type.EXCEPTION_MAPPER_FOUND); try { final Response mappedResponse = mapper.toResponse(throwable);
@Override public Continuation apply(final RequestProcessingContext processingContext) { Object subResourceInstance = getResource(processingContext); if (subResourceInstance == null) { throw new NotFoundException(); } final RoutingContext routingContext = processingContext.routingContext(); final LocatorRouting routing; if (subResourceInstance instanceof Resource) { // Caching here is disabled by default. It can be enabled by setting // ServerProperties.SUBRESOURCE_LOCATOR_CACHE_JERSEY_RESOURCE_ENABLED to true. routing = runtimeLocatorBuilder.getRouting((Resource) subResourceInstance); } else { Class<?> locatorClass = subResourceInstance.getClass(); if (locatorClass.isAssignableFrom(Class.class)) { // subResourceInstance is class itself locatorClass = (Class<?>) subResourceInstance; if (!runtimeLocatorBuilder.isCached(locatorClass)) { // If we can't create an instance of the class, don't proceed. subResourceInstance = createFunction.apply(locatorClass); } } routingContext.pushMatchedResource(subResourceInstance); resourceContext.bindResourceIfSingleton(subResourceInstance); routing = runtimeLocatorBuilder.getRouting(locatorClass); } routingContext.pushLocatorSubResource(routing.locator.getResources().get(0)); processingContext.triggerEvent(RequestEvent.Type.SUBRESOURCE_LOCATED); return Continuation.of(processingContext, routing.router); }
@Override public Continuation apply(final RequestProcessingContext processingContext) { Object subResourceInstance = getResource(processingContext); if (subResourceInstance == null) { throw new NotFoundException(); } final RoutingContext routingContext = processingContext.routingContext(); final LocatorRouting routing; if (subResourceInstance instanceof Resource) { // Caching here is disabled by default. It can be enabled by setting // ServerProperties.SUBRESOURCE_LOCATOR_CACHE_JERSEY_RESOURCE_ENABLED to true. routing = runtimeLocatorBuilder.getRouting((Resource) subResourceInstance); } else { Class<?> locatorClass = subResourceInstance.getClass(); if (locatorClass.isAssignableFrom(Class.class)) { // subResourceInstance is class itself locatorClass = (Class<?>) subResourceInstance; if (!runtimeLocatorBuilder.isCached(locatorClass)) { // If we can't create an instance of the class, don't proceed. subResourceInstance = createFunction.apply(locatorClass); } } routingContext.pushMatchedResource(subResourceInstance); resourceContext.bindResourceIfSingleton(subResourceInstance); routing = runtimeLocatorBuilder.getRouting(locatorClass); } routingContext.pushLocatorSubResource(routing.locator.getResources().get(0)); processingContext.triggerEvent(RequestEvent.Type.SUBRESOURCE_LOCATED); return Continuation.of(processingContext, routing.router); }
processingContext.triggerEvent(RequestEvent.Type.RESP_FILTERS_START); processingContext.triggerEvent(RequestEvent.Type.RESP_FILTERS_FINISHED); tracingLogger.logDuration(ServerTraceEvent.RESPONSE_FILTER_SUMMARY, timestamp, processedCount);
processingContext.triggerEvent(RequestEvent.Type.RESP_FILTERS_START); processingContext.triggerEvent(RequestEvent.Type.RESP_FILTERS_FINISHED); tracingLogger.logDuration(ServerTraceEvent.RESPONSE_FILTER_SUMMARY, timestamp, processedCount);
final ContainerRequest request = processingContext.request(); processingContext.monitoringEventBuilder().setException(throwable, RequestEvent.ExceptionCause.ORIGINAL); processingContext.triggerEvent(RequestEvent.Type.ON_EXCEPTION); .setResponseSuccessfullyMapped(true); } finally { processingContext.triggerEvent(RequestEvent.Type.EXCEPTION_MAPPING_FINISHED); processingContext.monitoringEventBuilder() .setException(respError, RequestEvent.ExceptionCause.MAPPED_RESPONSE); processingContext.triggerEvent(RequestEvent.Type.ON_EXCEPTION); throw respError;
final ContainerRequest request = processingContext.request(); processingContext.monitoringEventBuilder().setException(throwable, RequestEvent.ExceptionCause.ORIGINAL); processingContext.triggerEvent(RequestEvent.Type.ON_EXCEPTION); .setResponseSuccessfullyMapped(true); } finally { processingContext.triggerEvent(RequestEvent.Type.EXCEPTION_MAPPING_FINISHED); processingContext.monitoringEventBuilder() .setException(respError, RequestEvent.ExceptionCause.MAPPED_RESPONSE); processingContext.triggerEvent(RequestEvent.Type.ON_EXCEPTION); throw respError;
final Object[] parameterValues = ParameterValueHelper.getParameterValues(valueProviders, context.request()); context.triggerEvent(RequestEvent.Type.LOCATOR_MATCHED);
final Object[] parameterValues = ParameterValueHelper.getParameterValues(valueProviders, context.request()); context.triggerEvent(RequestEvent.Type.LOCATOR_MATCHED);
context.triggerEvent(RequestEvent.Type.REQUEST_MATCHED); context.triggerEvent(RequestEvent.Type.REQUEST_FILTERED);
context.triggerEvent(RequestEvent.Type.REQUEST_MATCHED); context.triggerEvent(RequestEvent.Type.REQUEST_FILTERED);
/** * {@inheritDoc} * <p/> * Routing stage navigates through the nested {@link Router routing hierarchy} * using a depth-first transformation strategy until a request-to-response * inflector is {@link org.glassfish.jersey.process.internal.Inflecting found on * a leaf stage node}, in which case the request routing is terminated and an * {@link org.glassfish.jersey.process.Inflector inflector} (if found) is pushed * to the {@link RoutingContext routing context}. */ @Override public Continuation<RequestProcessingContext> apply(final RequestProcessingContext context) { final ContainerRequest request = context.request(); context.triggerEvent(RequestEvent.Type.MATCHING_START); final TracingLogger tracingLogger = TracingLogger.getInstance(request); final long timestamp = tracingLogger.timestamp(ServerTraceEvent.MATCH_SUMMARY); try { final RoutingResult result = _apply(context, routingRoot); Stage<RequestProcessingContext> nextStage = null; if (result.endpoint != null) { context.routingContext().setEndpoint(result.endpoint); nextStage = getDefaultNext(); } return Continuation.of(result.context, nextStage); } finally { tracingLogger.logDuration(ServerTraceEvent.MATCH_SUMMARY, timestamp); } }
/** * {@inheritDoc} * <p/> * Routing stage navigates through the nested {@link Router routing hierarchy} * using a depth-first transformation strategy until a request-to-response * inflector is {@link org.glassfish.jersey.process.internal.Inflecting found on * a leaf stage node}, in which case the request routing is terminated and an * {@link org.glassfish.jersey.process.Inflector inflector} (if found) is pushed * to the {@link RoutingContext routing context}. */ @Override public Continuation<RequestProcessingContext> apply(final RequestProcessingContext context) { final ContainerRequest request = context.request(); context.triggerEvent(RequestEvent.Type.MATCHING_START); final TracingLogger tracingLogger = TracingLogger.getInstance(request); final long timestamp = tracingLogger.timestamp(ServerTraceEvent.MATCH_SUMMARY); try { final RoutingResult result = _apply(context, routingRoot); Stage<RequestProcessingContext> nextStage = null; if (result.endpoint != null) { context.routingContext().setEndpoint(result.endpoint); nextStage = getDefaultNext(); } return Continuation.of(result.context, nextStage); } finally { tracingLogger.logDuration(ServerTraceEvent.MATCH_SUMMARY, timestamp); } }
private void release(final ContainerResponse responseContext) { try { processingContext.closeableService().close(); // Commit the container response writer if not in chunked mode // responseContext may be null in case the request processing was cancelled. if (responseContext != null && !responseContext.isChunked()) { // responseContext.commitStream(); responseContext.close(); } } catch (final Throwable throwable) { LOGGER.log(Level.WARNING, LocalizationMessages.RELEASING_REQUEST_PROCESSING_RESOURCES_FAILED(), throwable); } finally { runtime.externalRequestScope.close(); processingContext.triggerEvent(RequestEvent.Type.FINISHED); } } }
final Object[] parameterValues = ParameterValueHelper.getParameterValues(valueProviders, context.request()); context.triggerEvent(RequestEvent.Type.LOCATOR_MATCHED);