Search in sources :

Example 6 with ValidationImpl

use of org.webpieces.router.impl.ctx.ValidationImpl in project webpieces by deanhiller.

the class AbstractRouterService method incomingCompleteRequest.

@Override
public final CompletableFuture<Void> incomingCompleteRequest(RouterRequest routerRequest, ResponseStreamer responseCb) {
    try {
        if (!started)
            throw new IllegalStateException("Either start was not called by client or start threw an exception that client ignored and must be fixed");
        ;
        Session session = (Session) cookieTranslator.translateCookieToScope(routerRequest, new SessionImpl(translator));
        FlashSub flash = (FlashSub) cookieTranslator.translateCookieToScope(routerRequest, new FlashImpl(translator));
        Validation validation = (Validation) cookieTranslator.translateCookieToScope(routerRequest, new ValidationImpl(translator));
        RequestContext requestCtx = new RequestContext(validation, flash, session, routerRequest);
        return processRequest(requestCtx, responseCb);
    } catch (BadCookieException e) {
        throw e;
    } catch (Throwable e) {
        log.warn("uncaught exception", e);
        return responseCb.failureRenderingInternalServerErrorPage(e);
    }
}
Also used : Validation(org.webpieces.ctx.api.Validation) BadCookieException(org.webpieces.router.api.exceptions.BadCookieException) SessionImpl(org.webpieces.router.impl.ctx.SessionImpl) FlashImpl(org.webpieces.router.impl.ctx.FlashImpl) RequestContext(org.webpieces.ctx.api.RequestContext) FlashSub(org.webpieces.ctx.api.FlashSub) Session(org.webpieces.ctx.api.Session) ValidationImpl(org.webpieces.router.impl.ctx.ValidationImpl)

Aggregations

RequestContext (org.webpieces.ctx.api.RequestContext)6 FlashImpl (org.webpieces.router.impl.ctx.FlashImpl)6 SessionImpl (org.webpieces.router.impl.ctx.SessionImpl)6 ValidationImpl (org.webpieces.router.impl.ctx.ValidationImpl)6 Test (org.junit.Test)5 RouterRequest (org.webpieces.ctx.api.RouterRequest)5 MockResponseStream (org.webpieces.router.api.mocks.MockResponseStream)5 RouterService (org.webpieces.router.api.RouterService)3 RedirectResponse (org.webpieces.router.api.dto.RedirectResponse)2 FlashSub (org.webpieces.ctx.api.FlashSub)1 Session (org.webpieces.ctx.api.Session)1 Validation (org.webpieces.ctx.api.Validation)1 BadCookieException (org.webpieces.router.api.exceptions.BadCookieException)1