/** * Create a continuation from the routed request and a single * of next level routers. * * @param request routed request. * @param next next level router. * @return a continuation with the supplied next level router to be invoked * {@link #next() next} in the routing chain and the supplied routed * request. */ static Continuation of(final RequestProcessingContext request, final Router next) { return new Continuation(request, Collections.singletonList(next)); }
@SuppressWarnings("unchecked") private RoutingResult _apply(final RequestProcessingContext request, final Router router) { final Router.Continuation continuation = router.apply(request); for (Router child : continuation.next()) { RoutingResult result = _apply(continuation.requestContext(), child); if (result.endpoint != null) { // we're done return result; } // else continue } Endpoint endpoint = Routers.extractEndpoint(router); if (endpoint != null) { // inflector at terminal stage found return RoutingResult.from(continuation.requestContext(), endpoint); } // inflector at terminal stage not found return RoutingResult.from(continuation.requestContext()); }
@SuppressWarnings("unchecked") private RoutingResult _apply(final RequestProcessingContext request, final Router router) { final Router.Continuation continuation = router.apply(request); for (Router child : continuation.next()) { RoutingResult result = _apply(continuation.requestContext(), child); if (result.endpoint != null) { // we're done return result; } // else continue } Endpoint endpoint = Routers.extractEndpoint(router); if (endpoint != null) { // inflector at terminal stage found return RoutingResult.from(continuation.requestContext(), endpoint); } // inflector at terminal stage not found return RoutingResult.from(continuation.requestContext()); }
@SuppressWarnings("unchecked") private RoutingResult _apply(final RequestProcessingContext request, final Router router) { final Router.Continuation continuation = router.apply(request); for (Router child : continuation.next()) { RoutingResult result = _apply(continuation.requestContext(), child); if (result.endpoint != null) { // we're done return result; } // else continue } Endpoint endpoint = Routers.extractEndpoint(router); if (endpoint != null) { // inflector at terminal stage found return RoutingResult.from(continuation.requestContext(), endpoint); } // inflector at terminal stage not found return RoutingResult.from(continuation.requestContext()); }
@SuppressWarnings("unchecked") private RoutingResult _apply(final RequestProcessingContext request, final Router router) { final Router.Continuation continuation = router.apply(request); for (Router child : continuation.next()) { RoutingResult result = _apply(continuation.requestContext(), child); if (result.endpoint != null) { // we're done return result; } // else continue } Endpoint endpoint = Routers.extractEndpoint(router); if (endpoint != null) { // inflector at terminal stage found return RoutingResult.from(continuation.requestContext(), endpoint); } // inflector at terminal stage not found return RoutingResult.from(continuation.requestContext()); }
@Override public Continuation apply(final RequestProcessingContext processingContext) { final RoutingContext rc = processingContext.routingContext(); switch (resourceMethod.getType()) { case RESOURCE_METHOD: case SUB_RESOURCE_METHOD: rc.setMatchedResourceMethod(resourceMethod); break; case SUB_RESOURCE_LOCATOR: rc.pushMatchedLocator(resourceMethod); break; } return Continuation.of(processingContext); } }
@Override public Continuation apply(final RequestProcessingContext processingContext) { final RoutingContext rc = processingContext.routingContext(); switch (resourceMethod.getType()) { case RESOURCE_METHOD: case SUB_RESOURCE_METHOD: rc.setMatchedResourceMethod(resourceMethod); break; case SUB_RESOURCE_LOCATOR: rc.pushMatchedLocator(resourceMethod); break; } return Continuation.of(processingContext); } }
@Override public Continuation apply(final RequestProcessingContext processingContext) { final RoutingContext rc = processingContext.routingContext(); switch (resourceMethod.getType()) { case RESOURCE_METHOD: case SUB_RESOURCE_METHOD: rc.setMatchedResourceMethod(resourceMethod); break; case SUB_RESOURCE_LOCATOR: rc.pushMatchedLocator(resourceMethod); break; } return Continuation.of(processingContext); } }
@Override public Continuation apply(final RequestProcessingContext processingContext) { final RoutingContext rc = processingContext.routingContext(); switch (resourceMethod.getType()) { case RESOURCE_METHOD: case SUB_RESOURCE_METHOD: rc.setMatchedResourceMethod(resourceMethod); break; case SUB_RESOURCE_LOCATOR: rc.pushMatchedLocator(resourceMethod); break; } return Continuation.of(processingContext); } }
/** * Create a continuation from the routed request and a collection * of next level routers. * * @param result routed request. * @param next next level routers. * @return a continuation with the supplied next level routers to be invoked * {@link #next() next} in the routing chain and the supplied routed * request. */ static Continuation of(final RequestProcessingContext result, Iterable<Router> next) { return new Continuation(result, next); }
/** * Create a continuation from the routed request and a single * of next level routers. * * @param request routed request. * @param next next level router. * @return a continuation with the supplied next level router to be invoked * {@link #next() next} in the routing chain and the supplied routed * request. */ static Continuation of(final RequestProcessingContext request, final Router next) { return new Continuation(request, Collections.singletonList(next)); }
/** * Create a continuation from the routed request and a collection * of next level routers. * * @param result routed request. * @param next next level routers. * @return a continuation with the supplied next level routers to be invoked * {@link #next() next} in the routing chain and the supplied routed * request. */ static Continuation of(final RequestProcessingContext result, Iterable<Router> next) { return new Continuation(result, next); }
@Override public Continuation apply(final RequestProcessingContext context) { context.routingContext().pushMatchedRuntimeResource(resource); return Continuation.of(context); } }
@Override public Continuation apply(final RequestProcessingContext context) { context.routingContext().pushLeftHandPath(); return Continuation.of(context); } }
@Override public Continuation apply(final RequestProcessingContext context) { final RoutingContext routingContext = context.routingContext(); final Object storedResource = routingContext.peekMatchedResource(); if (storedResource == null || !storedResource.getClass().equals(methodHandler.getHandlerClass())) { Object handlerInstance = methodHandler.getInstance(context.serviceLocator()); routingContext.pushMatchedResource(handlerInstance); } return Continuation.of(context, next); } }
@Override public Continuation apply(final RequestProcessingContext context) { context.routingContext().pushTemplates(resourceTemplate, methodTemplate); return Continuation.of(context); } }
@Override public Continuation apply(final RequestProcessingContext context) { context.routingContext().pushMatchedRuntimeResource(resource); return Continuation.of(context); } }
@Override public Continuation apply(RequestProcessingContext context) { return Continuation.of(context); } }
@Override public Continuation apply(final RequestProcessingContext data) { return Continuation.of(data); } };