use of org.webpieces.router.impl.routeinvoker.InvokeInfo in project webpieces by deanhiller.
the class EInternalErrorRouter method invokeErrorRoute.
public XFuture<StreamWriter> invokeErrorRoute(RequestContext ctx, ProxyStreamHandle handle, Throwable exc) {
Endpoint info = new Endpoint(svc);
RouteInfoForInternalError data = new RouteInfoForInternalError(exc);
InvokeInfo invokeInfo = new InvokeInfo(ctx, handle, RouteType.INTERNAL_SERVER_ERROR, loadedController, i18nBundleName);
return invoker.invokeErrorController(invokeInfo, info, data).thenApply(voidd -> new NullStreamWriter());
}
use of org.webpieces.router.impl.routeinvoker.InvokeInfo in project webpieces by deanhiller.
the class DevRouteInvoker method invokeDevelopmentErrorPage.
private XFuture<Void> invokeDevelopmentErrorPage(InvokeInfo invokeInfo, RouteInfoForInternalError data) {
RequestContext requestCtx = invokeInfo.getRequestCtx();
ProxyStreamHandle handler = invokeInfo.getHandler();
RouterRequest req = requestCtx.getRequest();
Throwable exception = data.getException();
Injector webAppInjector = webInjector.getCurrentInjector();
RouteInfo routeInfo = new RouteInfo(new RouteModuleInfo("", null), "/org/webpieces/devrouter/impl/DevelopmentController.internalError");
SvcProxyFixedRoutes svcProxy = new SvcProxyFixedRoutes(serviceInvoker, futureUtil);
LoadedController newLoadedController = controllerFinder.loadGenericController(webAppInjector, routeInfo).getLoadedController();
Endpoint newInfo = new Endpoint(svcProxy);
RouterRequest newRequest = new RouterRequest();
newRequest.putMultipart("url", req.relativePath);
newRequest.isHttps = req.isHttps;
newRequest.isBackendRequest = req.isBackendRequest;
newRequest.originalRequest = req.originalRequest;
newRequest.requestState.put(DevelopmentController.ORIGINAL_REQUEST, req);
newRequest.requestState.put(DevelopmentController.EXCEPTION, exception);
newRequest.requestState.put(DevRouteInvoker.ERROR_KEY, req.requestState.get(DevRouteInvoker.ERROR_KEY));
ApplicationContext ctx = webInjector.getAppContext();
RequestContext overridenCtx = new RequestContext(requestCtx.getValidation(), (FlashSub) requestCtx.getFlash(), requestCtx.getSession(), newRequest, ctx);
InvokeInfo newInvokeInfo = new InvokeInfo(overridenCtx, handler, RouteType.INTERNAL_SERVER_ERROR, newLoadedController, null);
RequestContext oldContext = Current.getContext();
Current.setContext(overridenCtx);
try {
return super.invokeErrorController(newInvokeInfo, newInfo, data);
} finally {
Current.setContext(oldContext);
}
}
use of org.webpieces.router.impl.routeinvoker.InvokeInfo in project webpieces by deanhiller.
the class FContentRouter method invoke.
@Override
public RouterStreamRef invoke(RequestContext ctx, ProxyStreamHandle handler) {
RouteData data = new RouteInfoForContent(bodyContentBinder);
String i18nBundleName = moduleInfo.getI18nBundleName();
InvokeInfo invokeInfo = new InvokeInfo(ctx, handler, RouteType.CONTENT, loadedController, i18nBundleName);
return routeInvoker.invokeContentController(invokeInfo, dynamicInfo, data);
}
use of org.webpieces.router.impl.routeinvoker.InvokeInfo in project webpieces by deanhiller.
the class FStreamingRouter method invoke.
@Override
public RouterStreamRef invoke(RequestContext ctx, ProxyStreamHandle handler) {
RouteData data = new RouteInfoForStream();
InvokeInfo invokeInfo = new InvokeInfo(ctx, handler, RouteType.STREAMING, loadedController, i18nBundleName);
return routeInvoker.invokeStreamingController(invokeInfo, dynamicInfo, data);
}
use of org.webpieces.router.impl.routeinvoker.InvokeInfo in project webpieces by deanhiller.
the class ENotFoundRouter method invokeNotFoundRoute.
public XFuture<StreamWriter> invokeNotFoundRoute(RequestContext ctx, ProxyStreamHandle handle, NotFoundException exc) {
Endpoint info = new Endpoint(svc);
RouteInfoForNotFound data = new RouteInfoForNotFound(exc);
InvokeInfo invokeInfo = new InvokeInfo(ctx, handle, RouteType.NOT_FOUND, loadedController, i18nBaseBundle);
return invoker.invokeNotFound(invokeInfo, info, data).thenApply(voidd -> new NullWriter());
}
Aggregations