use of ratpack.path.internal.PathBindingStorage in project ratpack by ratpack.
the class DefaultContext method start.
public static void start(EventLoop eventLoop, final RequestConstants requestConstants, Registry registry, Handler[] handlers, Action<? super Execution> onComplete) {
ChainIndex index = new ChainIndex(handlers, registry, true);
requestConstants.indexes.push(index);
DefaultContext context = new DefaultContext(requestConstants);
requestConstants.context = context;
context.pathBindings = new PathBindingStorage(new RootPathBinding(requestConstants.request.getPath()));
requestConstants.applicationConstants.execController.fork().onError(throwable -> requestConstants.context.error(throwable instanceof HandlerException ? throwable.getCause() : throwable)).onComplete(onComplete).register(s -> s.add(Context.TYPE, context).add(Request.TYPE, requestConstants.request).add(Response.TYPE, requestConstants.response).add(PathBindingStorage.TYPE, context.pathBindings).addLazy(RequestId.TYPE, () -> registry.get(RequestId.Generator.TYPE).generate(requestConstants.request))).eventLoop(eventLoop).onStart(e -> DefaultRequest.setDelegateRegistry(requestConstants.request, e)).start(e -> {
requestConstants.execution = e;
context.joinedRegistry = new ContextRegistry(context).join(requestConstants.execution);
context.next();
});
}
Aggregations