@Override public PathMappingContext pathMappingContext() { return delegate().pathMappingContext(); }
@Override public O serve(ServiceRequestContext ctx, I req) throws Exception { final PathMappingContext mappingCtx = ctx.pathMappingContext(); final PathMapped<Service<I, O>> mapped = findService(mappingCtx.overridePath(ctx.mappedPath())); if (!mapped.isPresent()) { throw HttpStatusException.of(HttpStatus.NOT_FOUND); } final Optional<String> childPrefix = mapped.mapping().prefix(); if (childPrefix.isPresent()) { final PathMapping newMapping = PathMapping.ofPrefix(ctx.pathMapping().prefix().get() + childPrefix.get().substring(1)); final ServiceRequestContext newCtx = new CompositeServiceRequestContext( ctx, newMapping, mapped.mappingResult().path()); try (SafeCloseable ignored = newCtx.push(false)) { return mapped.value().serve(newCtx, req); } } else { return mapped.value().serve(ctx, req); } }