return Continuation.of(responseContext, getDefaultNext());
return Continuation.of(responseContext, getDefaultNext());
return Continuation.of(responseContext, getDefaultNext());
return Continuation.of(responseContext, getDefaultNext());
/** * {@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); } }
/** * {@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); } }
/** * Run the data through a chain of stages identified by the root stage. * * If an inflector is found in the leaf stage, it's reference is set into the {@code inflectorRef} * parameter. * * @param <DATA> processed data type. * @param data data to be processed. * @param rootStage root stage of the stage chain. * @param inflectorRef a mutable reference to an inflector. * @return processing result. */ public static <DATA, RESULT, T extends Inflector<DATA, RESULT>> DATA process( DATA data, Stage<DATA> rootStage, Ref<T> inflectorRef) { Stage<DATA> lastStage = rootStage; Stage.Continuation<DATA> continuation = Stage.Continuation.of(data, lastStage); while (continuation.next() != null) { lastStage = continuation.next(); continuation = lastStage.apply(continuation.result()); } inflectorRef.set(Stages.<DATA, RESULT, T>extractInflector(lastStage)); return continuation.result(); }
/** * Run the data through a chain of stages identified by the root stage. * * If an inflector is found in the leaf stage, it's reference is set into the {@code inflectorRef} * parameter. * * @param <DATA> processed data type. * @param data data to be processed. * @param rootStage root stage of the stage chain. * @param inflectorRef a mutable reference to an inflector. * @return processing result. */ public static <DATA, RESULT, T extends Inflector<DATA, RESULT>> DATA process( DATA data, Stage<DATA> rootStage, Ref<T> inflectorRef) { Stage<DATA> lastStage = rootStage; Stage.Continuation<DATA> continuation = Stage.Continuation.of(data, lastStage); while (continuation.next() != null) { lastStage = continuation.next(); continuation = lastStage.apply(continuation.result()); } inflectorRef.set(Stages.<DATA, RESULT, T>extractInflector(lastStage)); return continuation.result(); }
/** * Run the data through a chain of stages identified by the root stage. * * If an inflector is found in the leaf stage, it's reference is set into the {@code inflectorRef} * parameter. * * @param <DATA> processed data type. * @param data data to be processed. * @param rootStage root stage of the stage chain. * @param inflectorRef a mutable reference to an inflector. * @return processing result. */ public static <DATA, RESULT, T extends Inflector<DATA, RESULT>> DATA process( DATA data, Stage<DATA> rootStage, Ref<T> inflectorRef) { Stage<DATA> lastStage = rootStage; Stage.Continuation<DATA> continuation = Stage.Continuation.of(data, lastStage); while (continuation.next() != null) { lastStage = continuation.next(); continuation = lastStage.apply(continuation.result()); } inflectorRef.set(Stages.<DATA, RESULT, T>extractInflector(lastStage)); return continuation.result(); }
/** * Run the data through a chain of stages identified by the root stage. * * If an inflector is found in the leaf stage, it's reference is set into the {@code inflectorRef} * parameter. * * @param <DATA> processed data type. * @param data data to be processed. * @param rootStage root stage of the stage chain. * @param inflectorRef a mutable reference to an inflector. * @return processing result. */ public static <DATA, RESULT, T extends Inflector<DATA, RESULT>> DATA process( DATA data, Stage<DATA> rootStage, Ref<T> inflectorRef) { Stage<DATA> lastStage = rootStage; Stage.Continuation<DATA> continuation = Stage.Continuation.of(data, lastStage); while (continuation.next() != null) { lastStage = continuation.next(); continuation = lastStage.apply(continuation.result()); } inflectorRef.set(Stages.<DATA, RESULT, T>extractInflector(lastStage)); return continuation.result(); }
/** * Run the data through a chain of stages identified by the root stage. * * If an inflector is found in the leaf stage, it's reference is set into the {@code inflectorRef} * parameter. * * @param <DATA> processed data type. * @param data data to be processed. * @param rootStage root stage of the stage chain. * @param inflectorRef a mutable reference to an inflector. * @return processing result. */ public static <DATA, RESULT, T extends Inflector<DATA, RESULT>> DATA process( DATA data, Stage<DATA> rootStage, Ref<T> inflectorRef) { Stage<DATA> lastStage = rootStage; Stage.Continuation<DATA> continuation = Stage.Continuation.of(data, lastStage); while (continuation.next() != null) { lastStage = continuation.next(); continuation = lastStage.apply(continuation.result()); } inflectorRef.set(Stages.<DATA, RESULT, T>extractInflector(lastStage)); return continuation.result(); }
@Override public Continuation<ClientRequest> apply(ClientRequest requestContext) { for (ClientRequestFilter filter : requestFilters) { try { filter.filter(requestContext); final Response abortResponse = requestContext.getAbortResponse(); if (abortResponse != null) { throw new AbortException(new ClientResponse(requestContext, abortResponse)); } } catch (IOException ex) { throw new ProcessingException(ex); } } return Continuation.of(requestContext, getDefaultNext()); } }
@Override public Continuation<ClientRequest> apply(ClientRequest requestContext) { for (ClientRequestFilter filter : requestFilters) { try { filter.filter(requestContext); final Response abortResponse = requestContext.getAbortResponse(); if (abortResponse != null) { throw new AbortException(new ClientResponse(requestContext, abortResponse)); } } catch (IOException ex) { throw new ProcessingException(ex); } } return Continuation.of(requestContext, getDefaultNext()); } }