本文整理汇总了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);
}
}
示例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();
}
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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);
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
}
示例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);
}
}