01: // HttpException.java
02: // $Id: HttpException.java,v 1.5 2003/10/14 12:46:12 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1996.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.www.protocol.http;
07:
08: /**
09: * Exception thrown when processing a request failed.
10: */
11:
12: public class HttpException extends Exception {
13: Request request = null;
14: Reply reply = null;
15: Exception exception = null;
16:
17: /**
18: * Get the original cause for this exception.
19: * HttpException can be used to wrap up transport layer problems (such
20: * as IOException or other SocketException, etc). In that case, this method
21: * will return the original exception that occured.
22: * @return An Exception instance, or <strong>null</strong>.
23: */
24:
25: public final Exception getException() {
26: return exception;
27: }
28:
29: /**
30: * Get the request that triggered this exception.
31: * @return A Request instance.
32: */
33:
34: public final Request getRequest() {
35: return request;
36: }
37:
38: /**
39: * Get the reply generated (if any)
40: * @return A Request instance.
41: */
42:
43: public final Reply getReply() {
44: return reply;
45: }
46:
47: public HttpException(Request request, Reply reply, String msg) {
48: super (msg);
49: this .request = request;
50: this .reply = reply;
51: }
52:
53: public HttpException(Request request, Reply reply, Exception ex,
54: String msg) {
55: super (msg);
56: this .request = request;
57: this .reply = reply;
58: this .exception = ex;
59: }
60:
61: public HttpException(Request request, Reply reply, Exception ex) {
62: super (ex.getMessage());
63: this .request = request;
64: this .exception = ex;
65: this .reply = reply;
66: }
67:
68: public HttpException(Reply reply, String msg) {
69: this (null, reply, msg);
70: }
71:
72: public HttpException(Request request, String msg) {
73: this (request, null, msg);
74: }
75:
76: public HttpException(Reply reply, Exception ex) {
77: this (null, reply, ex);
78: }
79:
80: public HttpException(Request request, Exception ex) {
81: this (request, null, ex);
82: }
83:
84: public HttpException(Exception ex, String msg) {
85: super(msg);
86: this.exception = ex;
87: }
88: }
|