--- /dev/null
+// HttpException.java\r
+// $Id: HttpException.java,v 1.1 2010/06/15 12:25:13 smhuang Exp $\r
+// (c) COPYRIGHT MIT and INRIA, 1996.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+\r
+package org.w3c.www.protocol.http;\r
+\r
+/**\r
+ * Exception thrown when processing a request failed.\r
+ */\r
+\r
+public class HttpException extends Exception {\r
+ Request request = null;\r
+ Reply reply = null;\r
+ Exception exception = null;\r
+\r
+ /**\r
+ * Get the original cause for this exception.\r
+ * HttpException can be used to wrap up transport layer problems (such\r
+ * as IOException or other SocketException, etc). In that case, this method\r
+ * will return the original exception that occured.\r
+ * @return An Exception instance, or <strong>null</strong>.\r
+ */\r
+\r
+ public final Exception getException() {\r
+ return exception;\r
+ }\r
+\r
+ /**\r
+ * Get the request that triggered this exception.\r
+ * @return A Request instance.\r
+ */\r
+\r
+ public final Request getRequest() {\r
+ return request;\r
+ }\r
+\r
+ /**\r
+ * Get the reply generated (if any)\r
+ * @return A Request instance.\r
+ */\r
+\r
+ public final Reply getReply() {\r
+ return reply;\r
+ }\r
+\r
+ public HttpException(Request request, Reply reply, String msg) {\r
+ super(msg);\r
+ this.request = request;\r
+ this.reply = reply;\r
+ }\r
+\r
+ public HttpException(Request request, Reply reply, Exception ex, \r
+ String msg) {\r
+ super(msg);\r
+ this.request = request;\r
+ this.reply = reply;\r
+ this.exception = ex;\r
+ }\r
+\r
+ public HttpException(Request request, Reply reply, Exception ex) {\r
+ super(ex.getMessage());\r
+ this.request = request;\r
+ this.exception = ex;\r
+ this.reply = reply;\r
+ }\r
+\r
+ public HttpException(Reply reply, String msg) {\r
+ this(null, reply, msg);\r
+ }\r
+\r
+ public HttpException(Request request, String msg) {\r
+ this(request, null, msg);\r
+ }\r
+ \r
+ public HttpException(Reply reply, Exception ex) {\r
+ this(null, reply, ex);\r
+ }\r
+\r
+ public HttpException(Request request, Exception ex) {\r
+ this(request, null, ex);\r
+ } \r
+\r
+ public HttpException(Exception ex, String msg) {\r
+ super(msg);\r
+ this.exception = ex;\r
+ }\r
+}\r