Improve output: distinguish between failed assertions (failures) and unexpected exceptions (errors), and print a filtered stack trace for any exception.

This commit is contained in:
jeb228 2010-01-29 22:13:57 +00:00
commit 4f2e303079
1839 changed files with 235630 additions and 0 deletions

View file

@ -0,0 +1,76 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.*" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ page errorPage="/error.jsp"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %>
<% /***********************************************
Display a single Page in the most basic fashion.
The html <HEAD> is generated followed by the banners and menu.
After that the result of the jsp in the attribute bodyJsp is inserted.
Finally comes the footer.
request.attributes:
"bodyJsp" - jsp of the body of this page.
"title" - title of page
"css" - optional additional css for page
"scripts" - optional name of file containing <script> elements to be included in the page
"bodyAttr" - optional attributes for the <body> tag, e.g. 'onload': use leading space
"portalBean" - PortalBean object for request.
Consider sticking < % = MiscWebUtils.getReqInfo(request) % > in the html output
for debugging info.
bdc34 2006-02-03 created
**********************************************/
/*
String e = "";
if (request.getAttribute("bodyJsp") == null){
e+="basicPage.jsp expects that request parameter 'bodyJsp' be set to the jsp to display as the page body.\n";
}
if (request.getAttribute("title") == null){
e+="basicPage.jsp expects that request parameter 'title' be set to the title to use for page.\n";
}
if (request.getAttribute("css") == null){
e+="basicPage.jsp expects that request parameter 'css' be set to css to include in page.\n";
}
if( request.getAttribute("portalBean") == null){
e+="basicPage.jsp expects that request attribute 'portalBean' be set.\n";
}
if( request.getAttribute("appBean") == null){
e+="basicPage.jsp expects that request attribute 'appBean' be set.\n";
}
if( e.length() > 0 ){
throw new JspException(e);
}
*/
%>
<c:set var="portal" value="${requestScope.portalBean}"/>
<c:set var="themeDir"><c:out value="${portal.themeDir}" /></c:set>
<c:set var="bodyJsp"><c:out value="${requestScope.bodyJsp}" default="/debug.jsp"/></c:set>
<jsp:include page="doctype.jsp"/>
<head>
<jsp:include page="headContent.jsp"/>
</head>
<body ${requestScope.bodyAttr}>
<div id="wrap" class="container">
<div id="header">
<jsp:include page="/${themeDir}jsp/identity.jsp" flush="true"/>
<jsp:include page="/${themeDir}jsp/menu.jsp" flush="true"/>
</div><!--header-->
<hr class="hidden" />
<div id="contentwrap">
<c:import url="${bodyJsp}"/>
</div> <!-- contentwrap -->
<jsp:include page="/${themeDir}jsp/footer.jsp" flush="true"/>
</div> <!-- wrap -->
</body>
</html>

View file

@ -0,0 +1,22 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<% /***********************************************
A JSP for displaying a simple message.
This JSP is intened to be wraped by basicPage.jsp
request.attributes:
"msg" the message to display on the page.
bdc34 2009-02-03 created
**********************************************/
if (request.getAttribute("msg") == null ){
throw new JspException(
"bodyMsg.jsp expects that request parameter 'msg' be set to"
+ " the message for the page.\n"
);
}
// only get the msg from the attributes, because of cross site exploits,
// never from the parameters.
out.print( (String)request.getAttribute("msg") );
%>

View file

@ -0,0 +1,15 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %>
<% /***********************************************
debug.jsp will just display the request info in a div.
It is uesful to use at the body jsp for a new controller before
you have writen the jsp that you intend to use.
bdc34 2006-02-06
**********************************************/
%>
<div class='debug'>
<%= MiscWebUtils.getReqInfo(request) %>
</div>

View file

@ -0,0 +1,5 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

View file

@ -0,0 +1,52 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ page import="javax.servlet.ServletException" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean"%>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%!
public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.templates.page.headContent.jsp");
%>
<%
VitroRequest vreq = new VitroRequest(request);
Portal portal = vreq.getPortal();
String themeDir = portal != null ? portal.getThemeDir() : Portal.DEFAULT_THEME_DIR_FROM_CONTEXT;
themeDir = request.getContextPath() + '/' + themeDir;
%>
<!-- headContent.jsp -->
<link rel="stylesheet" type="text/css" href="<%=themeDir%>css/screen.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="<%=themeDir%>css/print.css" media="print"/>
<%-- <c:url var="jqueryPath" value="/js/jquery.js"/>
<script type="text/javascript" src="${jqueryPath}"></script> --%>
<link rel="stylesheet" type="text/css" href="<%=themeDir%>css/edit.css"/>
<title><c:out value="${requestScope.title}"/></title>
<%
// nac26 080424: the following line should only be uncommented for PHILLIPS (vivo.cornell.edu) to ensure we're only tracking stats on the live site
// <script type="text/javascript" src="http://vivostats.mannlib.cornell.edu/?js"></script>
%>
<c:if test="${!empty scripts}"><jsp:include page="${scripts}"/></c:if>
<%--
mw542 021009: Brian C said this was ignoring the catch tags throwing exceptions. we should find a better way to include css/js anyway
<c:set var="customJsp"><c:out value="${requestScope.bodyJsp}" default="/debug.jsp"/></c:set>
<c:set var="customHeadJsp">
<c:if test="${fn:substringAfter(customJsp,'.jsp') == ''}">${fn:substringBefore(customJsp,'.jsp')}${"Head.jsp"}</c:if>
</c:set>
<c:if test="${customJsp != '/debug.jsp' && customHeadJsp != ''}">
<c:catch var="fileCheck">
<c:import url="${customHeadJsp}"/>
</c:catch>
</c:if>
--%>
<!-- end headContent.jsp -->