当前位置: 首页>>代码示例>>Java>>正文


Java RenderFactory类代码示例

本文整理汇总了Java中com.jfinal.render.RenderFactory的典型用法代码示例。如果您正苦于以下问题:Java RenderFactory类的具体用法?Java RenderFactory怎么用?Java RenderFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RenderFactory类属于com.jfinal.render包,在下文中一共展示了RenderFactory类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import com.jfinal.render.RenderFactory; //导入依赖的package包/类
public void render() {

        // render with view
        String view = getView();
        if (view != null) {
            RenderFactory.me().getRender(view).setContext(request, response).render();
            return;
        }

        // render with html content
        PrintWriter writer = null;
        try {
            response.setContentType(contentType);
            writer = response.getWriter();
            writer.write(getErrorHtml().toJson());
            writer.flush();
        } catch (IOException e) {
            throw new RenderException(e);
        } finally {
            if (writer != null)
                writer.close();
        }
    }
 
开发者ID:jayqqaa12,项目名称:jbase,代码行数:24,代码来源:JsonErrorRender.java

示例2: handle

import com.jfinal.render.RenderFactory; //导入依赖的package包/类
@Override
public void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) {
    if (!target.startsWith("/api")) {
        this.nextHandler.handle(target, request, response, isHandled);
        return;
    }
    
    if (JFinal.me().getAction(target, new String[1]) == null) {
        isHandled[0] = true;
        try {
            request.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        RenderFactory.me().getJsonRender(new BaseResponse(Code.NOT_FOUND, "resource is not found")).setContext(request, response).render();
    } else {
        this.nextHandler.handle(target, request, response, isHandled);
    }
}
 
开发者ID:kevin09002,项目名称:jfinal-api-scaffold,代码行数:20,代码来源:APINotFoundHandler.java

示例3: render

import com.jfinal.render.RenderFactory; //导入依赖的package包/类
public void render() {
    response.setStatus(getErrorCode());    // HttpServletResponse.SC_XXX_XXX

    // render with view
    String view = getView();
    if (view != null) {
        RenderFactory.me().getRender(view).setContext(request, response).render();
        return;
    }

    // render with html content
    PrintWriter writer = null;
    try {
        response.setContentType(contentType);
        writer = response.getWriter();
        writer.write(getErrorHtml());
        writer.flush();
    } catch (IOException e) {
        throw new RenderException(e);
    } finally {
        if (writer != null) {
            writer.close();
        }
    }
}
 
开发者ID:GojaFramework,项目名称:goja,代码行数:26,代码来源:GojaErrorRender.java

示例4: handle

import com.jfinal.render.RenderFactory; //导入依赖的package包/类
@Override
public void handle(String target, HttpServletRequest request, HttpServletResponse response, boolean[] isHandled) {
    if (checkView(target)) {
        isHandled[0] = true;
        RenderFactory.me().getErrorRender(403).setContext(request, response).render();
        return;
    }
    next.handle(target, request, response, isHandled);
}
 
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:10,代码来源:AccessDeniedHandler.java

示例5: render

import com.jfinal.render.RenderFactory; //导入依赖的package包/类
@Override
public void render() {
    RenderFactory.me().getRender(view).setContext(request, response).render();
}
 
开发者ID:gumutianqi,项目名称:jfinal-plus,代码行数:5,代码来源:ExceptionInterceptor.java


注:本文中的com.jfinal.render.RenderFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。