abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject svn commit: r470891 - /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java
Date Fri, 03 Nov 2006 16:41:29 GMT
Author: ugo
Date: Fri Nov  3 08:41:28 2006
New Revision: 470891

URL: http://svn.apache.org/viewvc?view=rev&rev=470891
Log:
Better diagnostics. Stack trace is output and logged.

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java?view=diff&rev=470891&r1=470890&r2=470891
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/AbderaServlet.java
Fri Nov  3 08:41:28 2006
@@ -18,6 +18,7 @@
 package org.apache.abdera.protocol.server.servlet;
 
 import java.io.IOException;
+import java.io.PrintWriter;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
@@ -30,14 +31,21 @@
 
 import org.apache.abdera.protocol.server.ServiceContext;
 import org.apache.abdera.protocol.server.ServiceManager;
-import org.apache.abdera.protocol.server.servlet.RequestHandler;
-import org.apache.abdera.protocol.server.servlet.RequestHandlerManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
+/**
+ * Sample APP servlet.
+ * 
+ * @version $Id$
+ */
 public class AbderaServlet 
   extends HttpServlet {
 
   private static final long serialVersionUID = 2393643907128535158L;
   
+  private final static Log logger = LogFactory.getLog(AbderaServlet.class);
+  
   protected ServiceManager serviceManager;
   
   public void init() throws ServletException {
@@ -57,7 +65,12 @@
     try {
       handler.process(context, request, response);
     } catch (Throwable t) {
-      response.sendError(500);
+      logger.error("Error servicing request", t);
+      response.setContentType("text/plain");
+      PrintWriter out = response.getWriter();
+      out.println(t);
+      t.printStackTrace(out);
+      response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
     } finally {
       manager.release(handler);
     }



Mime
View raw message