01: /*
02: * Report.java February 2004
03: *
04: * Copyright (C) 2004, Niall Gallagher <niallg@users.sf.net>
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General
16: * Public License along with this library; if not, write to the
17: * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18: * Boston, MA 02111-1307 USA
19: */
20:
21: package simple.http.serve;
22:
23: /**
24: * The <code>Report</code> interface is used to describe a HTTP
25: * response message. Reporting the various HTTP error and status
26: * messages requires that a status code and textual description
27: * be provided in the response, also depending on the type of
28: * response a description of the cause can be provided in the
29: * HTTP message body.
30: * <p>
31: * The <code>getCode</code> method must return a valid HTTP
32: * status code so that it can be used to describe the response,
33: * also the <code>getText</code> method must supply a short
34: * description of the response. For example, a description for
35: * the 404 HTTP status code would be 'File Not Found', for more
36: * information of valid descriptions see RFC 2616 section 6.1.1.
37: *
38: * @author Niall Gallagher
39: */
40: public interface Report {
41:
42: /**
43: * Returns the HTTP status code that this report represents.
44: * This will typically describe an error using one of the 4xx
45: * or 5xx HTTP status codes. For details on the specific types
46: * of status codes used by HTTP/1.1 see RFC 2616 section 6.1.1.
47: *
48: * @return the HTTP status code this report represents
49: */
50: public int getCode();
51:
52: /**
53: * Returns a short description of what caused this report.
54: * This will typically describe an error using one of the 4xx
55: * or 5xx HTTP status codes. For details on the specific types
56: * of status codes used by HTTP/1.1 see RFC 2616 section 6.1.1.
57: *
58: * @return the short description of what caused the report
59: */
60: public String getText();
61:
62: /**
63: * This is used to acquire a detailed message describing the
64: * cause of the error. Typically this will display exceptions
65: * caught while processing a HTTP request. The exception can
66: * be reported using the <code>printStackTrace</code> method.
67: *
68: * @return a detailed description of what caused the report
69: */
70: public String getCause();
71: }
|