public static void setErrorMessage(PortletRequest request, String errorMsg, Throwable t)
{
if ( errorMsg == null ) errorMsg = "null";
PortletSession pSession = request.getPortletSession(true);
pSession.setAttribute("error.message",errorMsg);
OutputStream oStream = new ByteArrayOutputStream();
PrintStream pStream = new PrintStream(oStream);
log.error("{}", oStream);
log.error("{}", pStream);
// errorMsg = errorMsg .replaceAll("<","<").replaceAll(">",">");
StringBuffer errorOut = new StringBuffer();
errorOut.append("<p class=\"portlet-msg-error\">\n");
errorOut.append(FormattedText.escapeHtmlFormattedText(errorMsg));
errorOut.append("\n</p>\n<!-- Traceback for this error\n");
errorOut.append(oStream.toString());
errorOut.append("\n-->\n");
pSession.setAttribute("error.output",errorOut.toString());
Map map = request.getParameterMap();
pSession.setAttribute("error.map",map);
}
PortletHelper.java 文件源码
java
阅读 16
收藏 0
点赞 0
评论 0
项目:sakai
作者:
评论列表
文章目录