Author: agilliland
Date: Fri May 18 12:46:13 2007
New Revision: 539576

URL: http://svn.apache.org/viewvc?view=rev&rev=539576
Log:
error pages for struts2.


Added:
    roller/trunk/web/WEB-INF/jsps/errors/
    roller/trunk/web/WEB-INF/jsps/errors/403.jsp
    roller/trunk/web/WEB-INF/jsps/errors/404.jsp
    roller/trunk/web/WEB-INF/jsps/errors/denied.jsp
    roller/trunk/web/WEB-INF/jsps/errors/error.jsp
Modified:
    roller/trunk/web/WEB-INF/classes/struts.xml
    roller/trunk/web/WEB-INF/jsps/tiles/struts2/tiles-errorpage.jsp
    roller/trunk/web/WEB-INF/tiles.xml
    roller/trunk/web/WEB-INF/web.xml

Modified: roller/trunk/web/WEB-INF/classes/struts.xml
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/classes/struts.xml?view=diff&rev=539576&r1=539575&r2=539576
==============================================================================
--- roller/trunk/web/WEB-INF/classes/struts.xml (original)
+++ roller/trunk/web/WEB-INF/classes/struts.xml Fri May 18 12:46:13 2007
@@ -63,9 +63,11 @@
         <!-- use our own interceptor stack which extends the default stack -->
         <default-interceptor-ref name="rollerStack"/>
         
+        
+        <!-- results made available to all actions -->
         <global-results>
             <result name="access-denied" type="tiles">.denied</result>
-            <result name="error">/error.jsp</result>
+            <result name="error" type="tiles">.error</result>
         </global-results>
         
         
@@ -83,6 +85,17 @@
             <result>/roller-ui/logout-redirect.jsp</result>
         </action>
         
+        <action name="error">
+            <result type="tiles">.error</result>
+        </action>
+        
+        <action name="403">
+            <result type="tiles">.403</result>
+        </action>
+        
+        <action name="404">
+            <result type="tiles">.404</result>
+        </action>
         
         <action name="setup"
                 class="org.apache.roller.ui.core.struts2.Setup">
@@ -373,22 +386,10 @@
             <result name="success" type="tiles">.Maintenance</result>
         </action>
         
-        
         <!--
-        
         <action name="importEntries!*" method="{1}"
                 
class="org.apache.roller.ui.authoring.struts2.ImportEntriesAction">
             <result name="importEntries.page">.import-entries</result>
-        </action>
-        
-        <action name="weblogEntryManagement!*" method="{1}"
-                
class="org.apache.roller.ui.authoring.struts2.WeblogEntryManagementAction">
-            <result 
name="weblogEntryManagement.page">.WeblogEntryManagement</result>
-        </action>
-        
-        <action name="referers!*" method="{1}"
-                class="org.apache.roller.ui.authoring.struts2.ReferersAction">
-            <result name="referers.page">.referers</result>
         </action>
         
         <action name="toggleLinkback!*" method="{1}"

Added: roller/trunk/web/WEB-INF/jsps/errors/403.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/jsps/errors/403.jsp?view=auto&rev=539576
==============================================================================
--- roller/trunk/web/WEB-INF/jsps/errors/403.jsp (added)
+++ roller/trunk/web/WEB-INF/jsps/errors/403.jsp Fri May 18 12:46:13 2007
@@ -0,0 +1,46 @@
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  The ASF licenses this file to You
+  under the Apache License, Version 2.0 (the "License"); you may not
+  use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.  For additional information regarding
+  copyright in this work, please see the NOTICE file in the top level
+  directory of this distribution.
+--%>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+
+<h2 class="error"><s:text name="error.title.403" /></h2>
+
+<c:set var="status_code" 
value="${requestScope['javax.servlet.error.status_code']}" />
+<c:set var="message"     
value="${requestScope['javax.servlet.error.message']}" />
+<c:set var="type"        value="${requestScope['javax.servlet.error.type']}" />
+
+<table width="80%" border="1px" style="border-collapse: collapse;">
+    <tr>
+        <td width="20%">Status Code</td>
+        <td><c:out value="${status_code}" /></td>
+    </tr>
+    <tr>
+        <td width="20%">Message</td>
+        <td><c:out value="${message}" /></td>
+    </tr>
+    <tr>
+        <td width="20%">Type</td>
+        <td><c:out value="${type}" /></td>
+    </tr>
+    <tr>
+        <td width="20%">Exception</td>
+        <td><s:text name="error.text.403" /></td>
+    </tr>
+</table>
+
+<br />
+<br />

Added: roller/trunk/web/WEB-INF/jsps/errors/404.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/jsps/errors/404.jsp?view=auto&rev=539576
==============================================================================
--- roller/trunk/web/WEB-INF/jsps/errors/404.jsp (added)
+++ roller/trunk/web/WEB-INF/jsps/errors/404.jsp Fri May 18 12:46:13 2007
@@ -0,0 +1,46 @@
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  The ASF licenses this file to You
+  under the Apache License, Version 2.0 (the "License"); you may not
+  use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.  For additional information regarding
+  copyright in this work, please see the NOTICE file in the top level
+  directory of this distribution.
+--%>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+
+<h2 class="error"><s:text name="error.title.404" /></h2>
+
+<c:set var="status_code" 
value="${requestScope['javax.servlet.error.status_code']}" />
+<c:set var="message"     
value="${requestScope['javax.servlet.error.message']}" />
+<c:set var="type"        value="${requestScope['javax.servlet.error.type']}" />
+
+<table width="80%" border="1px" style="border-collapse: collapse;">
+    <tr>
+        <td width="20%">Status Code</td>
+        <td><c:out value="${status_code}" /></td>
+    </tr>
+    <tr>
+        <td width="20%">Message</td>
+        <td><c:out value="${message}" /></td>
+    </tr>
+    <tr>
+        <td width="20%">Type</td>
+        <td><c:out value="${type}" /></td>
+    </tr>
+    <tr>
+        <td width="20%">Exception</td>
+        <td><s:text name="error.text.404" /></td>
+    </tr>
+</table>
+
+<br />
+<br />

Added: roller/trunk/web/WEB-INF/jsps/errors/denied.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/jsps/errors/denied.jsp?view=auto&rev=539576
==============================================================================
--- roller/trunk/web/WEB-INF/jsps/errors/denied.jsp (added)
+++ roller/trunk/web/WEB-INF/jsps/errors/denied.jsp Fri May 18 12:46:13 2007
@@ -0,0 +1,30 @@
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  The ASF licenses this file to You
+  under the Apache License, Version 2.0 (the "License"); you may not
+  use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.  For additional information regarding
+  copyright in this work, please see the NOTICE file in the top level
+  directory of this distribution.
+--%>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+<%@ page isErrorPage="true" %>
+
+<h2><s:text name="error.permissionDenied.title" /></h2>
+
+<s:text name="error.permissionDenied.prompt" />
+
+<ul>
+    <li><s:text name="error.permissionDenied.reason0" /></li>
+    <li><s:text name="error.permissionDenied.reason1" /></li>
+    <li><s:text name="error.permissionDenied.reason2" /></li>
+    <li><s:text name="error.permissionDenied.reason3" /></li>
+</ul>

Added: roller/trunk/web/WEB-INF/jsps/errors/error.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/jsps/errors/error.jsp?view=auto&rev=539576
==============================================================================
--- roller/trunk/web/WEB-INF/jsps/errors/error.jsp (added)
+++ roller/trunk/web/WEB-INF/jsps/errors/error.jsp Fri May 18 12:46:13 2007
@@ -0,0 +1,73 @@
+<%--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  The ASF licenses this file to You
+  under the Apache License, Version 2.0 (the "License"); you may not
+  use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.  For additional information regarding
+  copyright in this work, please see the NOTICE file in the top level
+  directory of this distribution.
+--%>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
+
+<h2 class="error"><s:text name="errorPage.title" /></h2>
+
+<s:if test="!getProp('site.debugMode')">
+    <p><s:text name="errorPage.message" /></p>
+</s:if>
+<s:else>
+    
+    <c:set var="status_code" 
value="${requestScope['javax.servlet.error.status_code']}" />
+    <c:set var="message"     
value="${requestScope['javax.servlet.error.message']}" />
+    <c:set var="type"        
value="${requestScope['javax.servlet.error.type']}" />
+    <c:set var="exception"   
value="${requestScope['javax.servlet.error.exception']}" />
+    
+    <table width="80%" border="1px" style="border-collapse: collapse;">
+        <tr>
+            <td width="20%">Status Code</td>
+            <td><c:out value="${status_code}" /></td>
+        </tr>
+        <tr>
+            <td width="20%">Message</td>
+            <td><c:out value="${message}" /></td>
+        </tr>
+        <tr>
+            <td width="20%">Type</td>
+            <td><c:out value="${type}" /></td>
+        </tr>
+        <tr>
+            <td width="20%">Exception</td>
+            <td><c:out value="${exception}" /></td>
+        </tr>
+    </table>
+    
+    <c:if test="${!empty exception}">
+        <% 
+        java.io.StringWriter sw = new java.io.StringWriter();
+        Throwable t = (Throwable)pageContext.getAttribute("exception");
+        if (t != null) {
+            t.printStackTrace(new java.io.PrintWriter(sw));
+            String stackTrace = sw.toString();
+            if (stackTrace.trim().length() > 0) {
+        %>
+        <p>Stack Trace:</p>
+        <form>
+            <textarea rows="30" style="font-size:8pt;width:80%">
+                <%=  stackTrace %>
+            </textarea>
+        </form>
+        <%  }
+        } %>
+    </c:if>
+    
+    <br />
+    <br />
+    
+</s:else>

Modified: roller/trunk/web/WEB-INF/jsps/tiles/struts2/tiles-errorpage.jsp
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/jsps/tiles/struts2/tiles-errorpage.jsp?view=diff&rev=539576&r1=539575&r2=539576
==============================================================================
--- roller/trunk/web/WEB-INF/jsps/tiles/struts2/tiles-errorpage.jsp (original)
+++ roller/trunk/web/WEB-INF/jsps/tiles/struts2/tiles-errorpage.jsp Fri May 18 
12:46:13 2007
@@ -15,71 +15,41 @@
   copyright in this work, please see the NOTICE file in the top level
   directory of this distribution.
 --%>
-<%@ include file="/WEB-INF/jsps/taglibs-error.jsp" %>
+<%@ include file="/WEB-INF/jsps/taglibs-struts2.jsp" %>
 <!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";>
-<head>
-<title><c:out value="${model.title}" /></title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<tiles:insert page="/WEB-INF/jsps/tiles/head.jsp"  />
-</head>
-<body>
-    
-<div id="wrapper"> 
-    <div id="leftcontent_wrap">
-        <div id="leftcontent"> 
-        </div>
-    </div>
-    
-    <div id="centercontent_wrap">
-        <div id="centercontent">   
-            <h1><c:out value="${model.title}" /></h1>
-            
-            <%-- Success Messages --%>
-            <logic:messagesPresent message="true">
-                <div id="messages" class="messages">
-                    <html:messages id="message" message="true">
-                        <c:out value="${message}" escapeXml="false"/><br />
-                    </html:messages>
+    <head>
+        <title><s:text name="error" /></title>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+        <tiles:insertAttribute name="head" />
+    </head>
+    <body>
+        
+        <div id="wrapper"> 
+            <div id="leftcontent_wrap">
+                <div id="leftcontent"> 
                 </div>
-            </logic:messagesPresent>
+            </div>
             
-            <%-- Error Messages --%>
-            <logic:messagesPresent>
-                <div id="errors" class="errors">
-                    <html:messages id="error">
-                        <c:out value="${error}" /><br />
-                    </html:messages>
+            <div id="centercontent_wrap">
+                <div id="centercontent">
+                    <tiles:insertAttribute name="messages" />
+                    <tiles:insertAttribute name="content" />    
                 </div>
-            </logic:messagesPresent>
+            </div>
             
-            <tiles:insert attribute="content" />    
+            <div id="rightcontent_wrap">
+                <div id="rightcontent"> 
+                </div>
+            </div>
+        </div>
+        
+        <div id="footer">
+            <tiles:insertAttribute name="footer" />
         </div>
-    </div>
-    
-    <div id="rightcontent_wrap">
-        <div id="rightcontent"> 
+        
+        <div id="datetagdiv" 
+             
style="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;">
         </div>
-    </div>
-</div>
-
-<div id="footer">
-    Powered by <a href="http://www.rollerweblogger.org";>Apache Roller 
(incubating)</a> 
-    <%= RollerFactory.getRoller().getVersion() %> |
-    
-    <a href="http://opensource2.atlassian.com/projects/roller/";>
-    <s:text name="footer.reportIssue" /></a> | 
-    
-    <a href="http://www.rollerweblogger.org/wiki/Wiki.jsp?page=UserGuide";>
-    <s:text name="footer.userGuide" /></a> | 
-    
-    <a href="http://rollerweblogger.org/wiki/Wiki.jsp?page=RollerMailingLists";>
-    <s:text name="footer.mailingLists" /></a>
-    
-</div>
-
-<div id="datetagdiv" 
-   
style="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;">
-</div>
-</body>
+    </body>
 </html>

Modified: roller/trunk/web/WEB-INF/tiles.xml
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/tiles.xml?view=diff&rev=539576&r1=539575&r2=539576
==============================================================================
--- roller/trunk/web/WEB-INF/tiles.xml (original)
+++ roller/trunk/web/WEB-INF/tiles.xml Fri May 18 12:46:13 2007
@@ -52,6 +52,28 @@
         <put name="footer"       
value="/WEB-INF/jsps/tiles/struts2/footer.jsp" />
     </definition>
     
+    <definition name=".tiles-errorpage" 
template="/WEB-INF/jsps/tiles/struts2/tiles-errorpage.jsp">
+        <put name="head"         value="/WEB-INF/jsps/tiles/struts2/head.jsp" 
/>
+        <put name="messages"     
value="/WEB-INF/jsps/tiles/struts2/messages.jsp" />
+        <put name="content"      value="${content}" />
+        <put name="footer"       
value="/WEB-INF/jsps/tiles/struts2/footer.jsp" />
+    </definition>
+    
+    
+    <!-- error pages -->
+    <definition name=".denied" extends=".tiles-errorpage" >
+        <put name="content" value="/WEB-INF/jsps/errors/denied.jsp" />
+    </definition>
+    <definition name=".error" extends=".tiles-errorpage" >
+        <put name="content" value="/WEB-INF/jsps/errors/error.jsp" />
+    </definition>
+    <definition name=".403" extends=".tiles-errorpage" >
+        <put name="content" value="/WEB-INF/jsps/errors/403.jsp" />
+    </definition>
+    <definition name=".404" extends=".tiles-errorpage" >
+        <put name="content" value="/WEB-INF/jsps/errors/404.jsp" />
+    </definition>
+    
     
     <!-- core pages (and associates) -->
     <definition name=".Setup" extends=".tiles-simplepage" >
@@ -300,21 +322,6 @@
     
     <definition name=".Maintenance" extends=".tiles-tabbedpage" >
         <put name="content" 
value="/WEB-INF/jsps/authoring/struts2/Maintenance.jsp" />
-    </definition>
-    
-    
-    <!-- error pages -->
-    <definition name=".denied" extends=".tiles-simplepage" >
-        <put name="content" value="/WEB-INF/jsps/denied.jsp" />
-    </definition>
-    <definition name=".error" extends=".tiles-simplepage" >
-        <put name="content" value="/WEB-INF/jsps/error.jsp" />
-    </definition>
-    <definition name=".error403" extends=".tiles-simplepage" >
-        <put name="content" value="/WEB-INF/jsps/error403.jsp" />
-    </definition>
-    <definition name=".error404" extends=".tiles-simplepage" >
-        <put name="content" value="/WEB-INF/jsps/error404.jsp" />
     </definition>
     
 </tiles-definitions>

Modified: roller/trunk/web/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/roller/trunk/web/WEB-INF/web.xml?view=diff&rev=539576&r1=539575&r2=539576
==============================================================================
--- roller/trunk/web/WEB-INF/web.xml (original)
+++ roller/trunk/web/WEB-INF/web.xml Fri May 18 12:46:13 2007
@@ -499,22 +499,22 @@
     
     <error-page>
         <exception-type>java.lang.Exception</exception-type>
-        <location>/WEB-INF/jsps/error.jsp</location>
+        <location>/roller-ui/error.rol</location>
     </error-page>
     
     <error-page>
         <error-code>403</error-code>
-        <location>/WEB-INF/jsps/403.jsp</location>
+        <location>/roller-ui/403.rol</location>
     </error-page>
     
     <error-page>
         <error-code>404</error-code>
-        <location>/WEB-INF/jsps/404.jsp</location>
+        <location>/roller-ui/404.rol</location>
     </error-page>
     
     <error-page>
         <error-code>400</error-code>
-        <location>/login-redirect.jsp</location>
+        <location>/roller-ui/login-redirect.rol</location>
     </error-page>
     
 


Reply via email to