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


Java RenderException类代码示例

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


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

示例1: render

import com.jfinal.render.RenderException; //导入依赖的package包/类
public void render() {
    PrintWriter writer = null;
    try {

        RenderHelpler.actionCacheExec(text, contentType);

        response.setHeader("Pragma", "no-cache");    // HTTP/1.0 caches might not implement Cache-Control and might only implement Pragma: no-cache
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);

        response.setContentType(contentType);
        response.setCharacterEncoding(getEncoding());    // 与 contentType 分开设置

        writer = response.getWriter();
        writer.write(text);
        writer.flush();
    } catch (IOException e) {
        throw new RenderException(e);
    }
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:21,代码来源:JbootTextRender.java

示例2: render

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

        if (jsonText == null) {
            buildJsonText();
        }

        RenderHelpler.actionCacheExec(jsonText, forIE ? contentTypeForIE : contentType);

        PrintWriter writer = null;
        try {
            response.setHeader("Pragma", "no-cache");    // HTTP/1.0 caches might not implement Cache-Control and might only implement Pragma: no-cache
            response.setHeader("Cache-Control", "no-cache");
            response.setDateHeader("Expires", 0);

            response.setContentType(forIE ? contentTypeForIE : contentType);
            writer = response.getWriter();
            writer.write(jsonText);
            writer.flush();
        } catch (IOException e) {
            throw new RenderException(e);
        } finally {
            if (writer != null) {
                writer.close();
            }
        }
    }
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:27,代码来源:JbootJsonRender.java

示例3: render

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

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

    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:yangfuhai,项目名称:jboot,代码行数:27,代码来源:JbootErrorRender.java

示例4: render

import com.jfinal.render.RenderException; //导入依赖的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

示例5: render

import com.jfinal.render.RenderException; //导入依赖的package包/类
@Override
public void render() {
    response.reset();
    PrintWriter out = null;
    try {
        response.setContentType("application/vnd.ms-excel;charset=" + encodeType);
        response.setHeader("Content-Disposition",
                "attachment;  filename=" + URLEncoder.encode(fileName, encodeType));
        out = response.getWriter();
        out.write(CsvUtil.createCSV(headers, data, clomuns));
    } catch (Exception e) {
        throw new RenderException(e);
    } finally {
        if (null != out) {
            out.flush();
            out.close();
        }
    }
}
 
开发者ID:jayqqaa12,项目名称:jbase,代码行数:20,代码来源:CsvRender.java

示例6: render

import com.jfinal.render.RenderException; //导入依赖的package包/类
@Override
public void render() {
    PrintWriter out = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        response.setContentType(CONTENT_TYPE);
        out = response.getWriter();
        out.write(genChartXml());
        out.flush();
    } catch (IOException e) {
        throw new RenderException(e);
    } finally {
        if (out != null) {
            out.close();
        }
    }

}
 
开发者ID:OpeningO,项目名称:JFinal-ext2,代码行数:21,代码来源:FunshionChartsRender.java

示例7: render

import com.jfinal.render.RenderException; //导入依赖的package包/类
@Override
public void render() {
    if (beans.isEmpty()) {
        buildBean();
    }
    response.setContentType(CONTENT_TYPE);
    response.setHeader("Content-Disposition", "attachment;Filename=" + filename);
    try {
        OutputStream out = response.getOutputStream();
        InputStream is = new BufferedInputStream(new FileInputStream(templetFile));
        XLSTransformer transformer = new XLSTransformer();
        Workbook workBook = transformer.transformXLS(is, beans);
        workBook.write(out);
    } catch (Exception e) {
        throw new RenderException(e);
    }

}
 
开发者ID:OpeningO,项目名称:JFinal-ext2,代码行数:19,代码来源:JxlsRender.java

示例8: render

import com.jfinal.render.RenderException; //导入依赖的package包/类
@Override
public void render() {
    PrintWriter writer = null;
    String dwz = "\"statusCode\":\"{0}\",\"message\":\"{1}\",\"navTabId\":\"{2}\",\"rel\":\"{3}\","
            + "\"callbackType\":\"{4}\",\"forwardUrl\":\"{5}\",\"confirmMsg\":\"{6}\"";
    dwz = "{\n"
            + MessageFormat.format(dwz, statusCode, message, navTabId, rel, callbackType, forwardUrl, confirmMsg)
            + "\n}";
    try {
        response.setHeader("Pragma", "no-cache"); // HTTP/1.0 caches might not implement Cache-Control and might
                                                  // only implement Pragma:
                                                  // no-cache
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        response.setContentType(CONTENT_TYPE);
        writer = response.getWriter();
        writer.write(dwz);
        writer.flush();
    } catch (IOException e) {
        throw new RenderException(e);
    } finally {
        if (writer != null) {
            writer.close();
        }
    }
}
 
开发者ID:OpeningO,项目名称:JFinal-ext2,代码行数:27,代码来源:DwzRender.java

示例9: render

import com.jfinal.render.RenderException; //导入依赖的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

示例10: render

import com.jfinal.render.RenderException; //导入依赖的package包/类
@Override
public void render() {
    if (beans.isEmpty()) {
        buildBean();
    }
    response.setContentType(CONTENT_TYPE);
    response.setHeader("Content-Disposition",
            "attachment;Filename=" + encodeChineseDownloadFileName(request, filename));
    try {
        OutputStream out = response.getOutputStream();
        InputStream is = new BufferedInputStream(new FileInputStream(templetFile));
        XLSTransformer transformer = new XLSTransformer();
        Workbook workBook = transformer.transformXLS(is, beans);
        workBook.write(out);
    } catch (Exception e) {
        throw new RenderException(e);
    }
}
 
开发者ID:GojaFramework,项目名称:goja,代码行数:19,代码来源:JxlsRender.java

示例11: renderHtml

import com.jfinal.render.RenderException; //导入依赖的package包/类
public static void renderHtml(HttpServletResponse response, String html, String contentType) {
    response.setContentType(contentType);
    PrintWriter responseWriter = null;
    try {
        responseWriter = response.getWriter();
        responseWriter.write(html);
        responseWriter.flush();
    } catch (Exception e) {
        throw new RenderException(e);
    } finally {
        if (responseWriter != null)
            responseWriter.close();
    }
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:15,代码来源:RenderHelpler.java

示例12: render

import com.jfinal.render.RenderException; //导入依赖的package包/类
@Override
public void render() {
    genChartXml();
    StringBuffer chart = new StringBuffer();
    chart.append(
            "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>"
                    + "<title>amCharts Example</title></head><body style='background-color:#EEEEEE'>")
            .append("<script type='text/javascript' src='").append(request.getContextPath() + path)
            .append("/flash/swfobject.js'></script><div id='chartdiv'></div><script type='text/javascript'>")
            .append("var params = {bgcolor:'#FFFFFF'}; var flashVars = {path: '")
            .append(request.getContextPath() + path).append("/flash/',settings_file:  encodeURIComponent('")
            .append(request.getContextPath() + SETTINGS_FILE_BASE).append(settingsFile).append("'),")
            .append("chart_data: \"").append(chartXml).append("\"};").append("swfobject.embedSWF('")
            .append(request.getContextPath() + path).append("/flash/").append(flashFile).append("', 'chartdiv', '")
            .append(width).append("', '").append(height).append("', '8.0.0', '")
            .append(request.getContextPath() + path)
            .append("/flash/expressInstall.swf', flashVars, params);</script></body></html>");
    PrintWriter writer = null;
    try {
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
        response.setContentType(CONTENT_TYPE);
        writer = response.getWriter();
        logger.debug("chart: " + chart.toString());
        writer.write(chart.toString());
        writer.flush();
    } catch (IOException e) {
        throw new RenderException(e);
    } finally {
        if (writer != null) {
            writer.close();
        }
    }
}
 
开发者ID:OpeningO,项目名称:JFinal-ext2,代码行数:36,代码来源:AmChartsRender.java

示例13: render

import com.jfinal.render.RenderException; //导入依赖的package包/类
protected void render(final String realView, final HttpServletRequest request, final HttpServletResponse response) {
    try {
        response.setContentType(CONTENT_TYPE);
        this.engineManager.renderTemplate(realView, ServletUtil.wrapToKeyValues(request, response), response);
    } catch (IOException ex) {
        throw new RenderException(ex);
    }
}
 
开发者ID:febit,项目名称:wit,代码行数:9,代码来源:WitRenderFactory.java


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