Search in sources :

Example 1 with RenderAny

use of act.view.RenderAny in project actframework by actframework.

the class RequestHandlerProxy method onResult.

private void onResult(Result result, ActionContext context) {
    context.dissolve();
    boolean isRenderAny = false;
    try {
        if (result instanceof RenderAny) {
            RenderAny any = (RenderAny) result;
            isRenderAny = true;
            any.apply(context);
        } else {
            H.Request req = context.req();
            ActResponse<?> resp = context.prepareRespForWrite();
            if (result instanceof ErrorResult) {
                resp.contentType(req.accept());
            }
            result.apply(req, resp);
        }
    } catch (RuntimeException e) {
        context.cacheTemplate(null);
        throw e;
    } finally {
        if (isRenderAny) {
            RenderAny.clearThreadLocals();
        }
    }
}
Also used : H(org.osgl.http.H) ErrorResult(org.osgl.mvc.result.ErrorResult) ActErrorResult(act.view.ActErrorResult) RenderAny(act.view.RenderAny)

Aggregations

ActErrorResult (act.view.ActErrorResult)1 RenderAny (act.view.RenderAny)1 H (org.osgl.http.H)1 ErrorResult (org.osgl.mvc.result.ErrorResult)1