View Javadoc

1   /*
2    * @(#)RetryException.java				0.3-3 06/05/2001
3    *
4    *  This file is part of the HTTPClient package
5    *  Copyright (C) 1996-2001 Ronald Tschalär
6    *
7    *  This library is free software; you can redistribute it and/or
8    *  modify it under the terms of the GNU Lesser General Public
9    *  License as published by the Free Software Foundation; either
10   *  version 2 of the License, or (at your option) any later version.
11   *
12   *  This library is distributed in the hope that it will be useful,
13   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   *  Lesser General Public License for more details.
16   *
17   *  You should have received a copy of the GNU Lesser General Public
18   *  License along with this library; if not, write to the Free
19   *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20   *  MA 02111-1307, USA
21   *
22   *  For questions, suggestions, bug-reports, enhancement-requests etc.
23   *  I may be contacted at:
24   *
25   *  ronald@innovation.ch
26   *
27   *  The HTTPClient's home page is located at:
28   *
29   *  http://www.innovation.ch/java/HTTPClient/ 
30   *
31   */
32  
33  package HTTPClient;
34  
35  import java.io.IOException;
36  
37  /**
38   * Signals that an exception was thrown and caught, and the request was
39   * retried.
40   *
41   * @version	0.3-3  06/05/2001
42   * @author	Ronald Tschalär
43   */
44  class RetryException extends IOException
45  {
46      /** the request to retry */
47      Request     request  = null;
48  
49      /** the response associated with the above request */
50      Response    response = null;
51  
52      /** the start of the liked list */
53      RetryException first = null;
54  
55      /** the next exception in the list */
56      RetryException next  = null;
57  
58      /** the original exception which caused the connection to be closed. */
59      IOException exception = null;
60  
61      /** was this exception generated because of an abnormal connection reset? */
62      boolean conn_reset = true;
63  
64      /** restart processing? */
65      boolean restart = false;
66  
67  
68      /**
69       * Constructs an RetryException with no detail message.
70       * A detail message is a String that describes this particular exception.
71       */
72      public RetryException()
73      {
74  	super();
75      }
76  
77  
78      /**
79       * Constructs an RetryException class with the specified detail message.
80       * A detail message is a String that describes this particular exception.
81       *
82       * @param s the String containing a detail message
83       */
84      public RetryException(String s)
85      {
86  	super(s);
87      }
88  
89  
90      // Methods
91  
92      /**
93       * Inserts this exception into the list.
94       *
95       * @param re the retry exception after which to add this one
96       */
97      void addToListAfter(RetryException re)
98      {
99  	if (re == null)  return;
100 
101 	if (re.next != null)
102 	    this.next = re.next;
103 	re.next = this;
104     }
105 }