Author: ajaquith
Date: Fri Jan 22 03:55:39 2010
New Revision: 901978
URL: http://svn.apache.org/viewvc?rev=901978&view=rev
Log:
Moved ErrorActionBean functions into MessageActionBean.
Modified:
incubator/jspwiki/trunk/src/WebContent/Error.jsp
incubator/jspwiki/trunk/src/WebContent/Message.jsp
Modified: incubator/jspwiki/trunk/src/WebContent/Error.jsp
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/Error.jsp?rev=901978&r1=901977&r2=901978&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/WebContent/Error.jsp (original)
+++ incubator/jspwiki/trunk/src/WebContent/Error.jsp Fri Jan 22 03:55:39 2010
@@ -19,88 +19,33 @@
under the License.
--%>
<%@ page isErrorPage="true" %>
-<%@ page import="org.apache.wiki.log.Logger" %>
-<%@ page import="org.apache.wiki.log.LoggerFactory" %>
-<%@ page import="org.apache.wiki.*" %>
-<%@ page import="org.apache.wiki.action.*" %>
-<%@ taglib uri="http://jakarta.apache.org/jspwiki.tld" prefix="wiki" %>
<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="s" %>
-<%@ page import="org.apache.wiki.util.FileUtil" %>
-<%!
- Logger log = LoggerFactory.getLogger("JSPWiki");
-%>
-<s:useActionBean beanclass="org.apache.wiki.action.ErrorActionBean"
id="wikiActionBean" />
-<%
- WikiEngine wiki = WikiEngine.getInstance( getServletConfig() );
- WikiContext wikiContext = WikiContextFactory.findContext( pageContext );
+<s:useActionBean beanclass="org.apache.wiki.action.MessageActionBean"
event="error" id="error" />
+<h3>JSPWiki has detected an error</h3>
+<dl>
+ <dt><b>Error</b></dt>
+ <dd>${error.message}</dd>
+ <dt><b>Cause</b></dt>
+ <dd>${error.realCause.class.name}</dd>
+ <dt><b>Detailed message</b></dt>
+ <dd>${error.realCause.message}</dd>
+ <dt><b>Place where detected</b></dt>
+ <dd>${error.throwingMethod}</dd>
+</dl>
+<p>
+If you have changed the templates, please do check them. This error message
+may show up because of that. If you have not changed them, and you are
+either installing JSPWiki for the first time or have changed configuration,
+then you might want to check your configuration files. If you are absolutely
sure
+that JSPWiki was running quite okay or you can't figure out what is going
+on, then by all means, come over to <a
href="http://www.jspwiki.org/">jspwiki.org</a>
+and tell us. There is more information in the log file (like the full stack
trace,
+which you should add to any error report).
+</p>
+<p>
+And don't worry - it's just a computer program. Nothing really
+serious is probably going on: at worst you can lose a few nights
+sleep. It's not like it's the end of the world.
+</p>
- response.setContentType("text/html; charset="+wiki.getContentEncoding() );
-
- String msg = "An unknown error was caught by Error.jsp";
-
- Throwable realcause = null;
-
- if( exception != null )
- {
- msg = exception.getMessage();
- if( msg == null || msg.length() == 0 )
- {
- msg = "An unknown exception "+exception.getClass().getName()+" was
caught by Error.jsp.";
- }
-
- //
- // This allows us to get the actual cause of the exception.
- // Note the cast; at least Tomcat has two classes called
"JspException"
- // imported in JSP pages.
- //
-
-
- if( exception instanceof javax.servlet.jsp.JspException )
- {
- log.debug("IS JSPEXCEPTION");
- realcause =
((javax.servlet.jsp.JspException)exception).getRootCause();
- log.debug("REALCAUSE="+realcause);
- }
-
- if( realcause == null ) realcause = exception;
- }
- else
- {
- realcause = new Exception("Unknown general exception");
- }
-
- log.debug("Error.jsp exception is: ",exception);
-
-
- wikiContext.getWikiSession().addMessage( msg );
-%>
-
- <h3>JSPWiki has detected an error</h3>
-
- <dl>
- <dt><b>Error Message</b></dt>
- <dd>
- <wiki:Messages div="error" />
- </dd>
- <dt><b>Exception</b></dt>
- <dd><%=realcause.getClass().getName()%></dd>
- <dt><b>Place where detected</b></dt>
- <dd><%=FileUtil.getThrowingMethod(realcause)%></dd>
- </dl>
- <p>
- If you have changed the templates, please do check them. This error message
- may show up because of that. If you have not changed them, and you are
- either installing JSPWiki for the first time or have changed configuration,
- then you might want to check your configuration files. If you are
absolutely sure
- that JSPWiki was running quite okay or you can't figure out what is going
- on, then by all means, come over to <a
href="http://www.jspwiki.org/">jspwiki.org</a>
- and tell us. There is more information in the log file (like the full
stack trace,
- which you should add to any error report).
- </p>
- <p>
- And don't worry - it's just a computer program. Nothing really
- serious is probably going on: at worst you can lose a few nights
- sleep. It's not like it's the end of the world.
- </p>
-
- <br clear="all" />
+<br clear="all" />
Modified: incubator/jspwiki/trunk/src/WebContent/Message.jsp
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/Message.jsp?rev=901978&r1=901977&r2=901978&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/WebContent/Message.jsp (original)
+++ incubator/jspwiki/trunk/src/WebContent/Message.jsp Fri Jan 22 03:55:39 2010
@@ -19,29 +19,10 @@
under the License.
--%>
<%@ page isErrorPage="true" %>
-<%@ page import="org.apache.wiki.log.Logger" %>
-<%@ page import="org.apache.wiki.log.LoggerFactory" %>
-<%@ page import="org.apache.wiki.*" %>
-<%@ page import="org.apache.wiki.action.*" %>
-<%@ page import="org.apache.wiki.ui.stripes.*" %>
-<%@ page import="org.apache.wiki.tags.WikiTagBase" %>
-<%@ taglib uri="http://jakarta.apache.org/jspwiki.tld" prefix="wiki" %>
<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="s" %>
-<%!
- Logger log = LoggerFactory.getLogger("JSPWiki");
-%>
-<s:useActionBean beanclass="org.apache.wiki.action.MessageActionBean"
id="wikiActionBean" />
-<%
- WikiEngine wiki = WikiEngine.getInstance( getServletConfig() );
- WikiContext wikiContext = WikiContextFactory.findContext( pageContext );
- MessageActionBean bean =
(MessageActionBean)WikiInterceptor.findActionBean( request );
-
- request.setAttribute( "message", bean.getMessage() );
-
- // Set the content type and include the response content
- response.setContentType("text/html; charset="+wiki.getContentEncoding() );
- String contentPage = wiki.getTemplateManager().findJSP( pageContext,
-
wikiContext.getTemplate(),
- "ViewTemplate.jsp"
);
-
-%><wiki:Include page="<%=contentPage%>" />
\ No newline at end of file
+<s:useActionBean beanclass="org.apache.wiki.action.MessageActionBean"
event="message" id="wikiActionBean" />
+<s:layout-render name="${templates['DefaultLayout.jsp']}">
+ <s:layout-component name="content">
+ <jsp:include page="${templates['DisplayMessage.jsp']}" />
+ </s:layout-component>
+</s:layout-render>