You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/08/15 08:17:25 UTC

svn commit: r232765 - in /webservices/axis/trunk/java/modules/core: conf/ src/org/apache/axis2/transport/http/ src/org/apache/axis2/transport/http/server/ webapp/

Author: ajith
Date: Sun Aug 14 23:16:41 2005
New Revision: 232765

URL: http://svn.apache.org/viewcvs?rev=232765&view=rev
Log:
Added the error handling support for the Admin App
1. Added an error JSP and a relevant exception
2. Modified the web XML
3. Modified the listing agent to throw the correct exception

Added:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/AdminAppException.java
    webservices/axis/trunk/java/modules/core/webapp/error.jsp
Modified:
    webservices/axis/trunk/java/modules/core/conf/web.xml
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java

Modified: webservices/axis/trunk/java/modules/core/conf/web.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/conf/web.xml?rev=232765&r1=232764&r2=232765&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/conf/web.xml (original)
+++ webservices/axis/trunk/java/modules/core/conf/web.xml Sun Aug 14 23:16:41 2005
@@ -97,4 +97,12 @@
         <servlet-name>AxisServlet</servlet-name>
         <url-pattern>/selectServiceParaEdit</url-pattern>
     </servlet-mapping>
+    <error-page>
+        <exception-type>org.apache.axis2.transport.http.server.AdminAppException</exception-type>
+        <location>/error.jsp</location>
+    </error-page>
+    <error-page>
+        <exception-type>java.lang.Exception</exception-type>
+        <location>/error.jsp</location>
+    </error-page>
 </web-app>

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java?rev=232765&r1=232764&r2=232765&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/AxisServlet.java Sun Aug 14 23:16:41 2005
@@ -134,6 +134,8 @@
             } else {
                 throw new ServletException(e);
             }
+        } catch (Exception e) {
+            throw new ServletException(e);
         }
 
     }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java?rev=232765&r1=232764&r2=232765&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java Sun Aug 14 23:16:41 2005
@@ -19,6 +19,7 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.transport.http.server.AdminAppException;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.description.OperationDescription;
@@ -93,7 +94,7 @@
     public void handle(HttpServletRequest httpServletRequest,
                        HttpServletResponse httpServletResponse,
                        OutputStream out)
-            throws IOException {
+            throws IOException,Exception {
         this.out = out;
         String filePart = httpServletRequest.getRequestURL().toString();
         if ((filePart != null) &&
@@ -212,14 +213,14 @@
         res.sendRedirect(SELECT_SERVICE_JSP_NAME);
     }
 
-    private void adminLogging(HttpServletRequest req, HttpServletResponse res) throws AxisFault, IOException {
+    private void adminLogging(HttpServletRequest req, HttpServletResponse res) throws AdminAppException, IOException {
         String username = req.getParameter("userName");
         String password = req.getParameter("password");
         if (username == null
                 || password == null
                 || username.trim().equals("")
                 || password.trim().equals("")) {
-            throw new AxisFault(Messages.getMessage("invaliduser"));
+            throw new AdminAppException(Messages.getMessage("invaliduser"));
         }
         String adminUserName =
                 (String) configContext.getAxisConfiguration()
@@ -236,12 +237,12 @@
             req.getSession().setAttribute(Constants.LOGGED, "Yes");
             res.sendRedirect(ADMIN_JSP_NAME);
         } else {
-            res.setContentType("text/css");
-            PrintWriter out_writer = new PrintWriter(out);
-            out_writer.println("Invalid user name password");
-            out_writer.flush();
-            out_writer.close();
-           // throw new AxisFault(Messages.getMessage("invaliduser"));
+//            res.setContentType("text/css");
+//            PrintWriter out_writer = new PrintWriter(out);
+//            out_writer.println("Invalid user name password");
+//            out_writer.flush();
+//            out_writer.close();
+            throw new AdminAppException(Messages.getMessage("invaliduser"));
         }
     }
 

Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/AdminAppException.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/AdminAppException.java?rev=232765&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/AdminAppException.java (added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/AdminAppException.java Sun Aug 14 23:16:41 2005
@@ -0,0 +1,36 @@
+package org.apache.axis2.transport.http.server;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ *
+ * 
+ */
+public class AdminAppException extends Exception{
+
+    public AdminAppException() {
+    }
+
+    public AdminAppException(String message) {
+        super(message);
+    }
+
+    public AdminAppException(Throwable cause) {
+        super(cause);
+    }
+
+    public AdminAppException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Added: webservices/axis/trunk/java/modules/core/webapp/error.jsp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/webapp/error.jsp?rev=232765&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/webapp/error.jsp (added)
+++ webservices/axis/trunk/java/modules/core/webapp/error.jsp Sun Aug 14 23:16:41 2005
@@ -0,0 +1,37 @@
+<%--
+ /*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed 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.
+*
+*
+*/
+
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@page isErrorPage="true" %>
+<html>
+  <head><title>Error !</title></head>
+  <body>
+  <jsp:include page="include/header.inc"></jsp:include>
+  <table>
+  <tr>
+  <td align="center">An error has occured!. Please check the details below</td>
+  </tr>
+  <tr>
+  <td align="center"><%=exception.getMessage()%></td>
+  </tr>
+  </table>
+<jsp:include page="include/footer.inc"></jsp:include>
+</body>
+</html>
\ No newline at end of file