Commit 84419f03 by Riku Silvola

errors

1 parent d6e5b3f7
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
<welcome-file>index.jsp</welcome-file> <welcome-file>index.jsp</welcome-file>
<welcome-file>index.wtf</welcome-file> <welcome-file>index.wtf</welcome-file>
</welcome-file-list> </welcome-file-list>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.jsf</location>
</error-page>
<servlet> <servlet>
<servlet-name>Faces Servlet</servlet-name> <servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
......
<!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" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<title></title>
</h:head>
<h:body>
<center>
<img src="#{request.contextPath}/resources/media/error.jpg" />
<h1>LOL, ERROR!</h1>
</center>
<c:when test="#{sessionHandler.isInDevelopmentMode()}">
<h:outputText escape="false" value="#{errorPageView.stackTrace}" />
</c:when>
</h:body>
</html>
\ No newline at end of file
package fi.insomnia.bortal.web;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import fi.insomnia.bortal.beans.CardPrintBeanLocal;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.web.cdiview.user.UserCartView;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Named
@RequestScoped
public class ErrorPageView {
String trace;
public String getStackTrace() {
FacesContext context = FacesContext.getCurrentInstance();
Map requestMap = context.getExternalContext().getRequestMap();
Throwable ex =
(Throwable) requestMap.get("javax.servlet.error.exception");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
trace = sw.toString();
return trace;
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!