1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 package org.apache.commons.httpclient.methods;
33
34 import org.apache.commons.httpclient.HttpMethodBase;
35
36 /***
37 * Implements the HTTP TRACE method.
38 * <p>
39 * The HTTP TRACE method is defined in section 9.6 of
40 * <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>:
41 * <blockquote>
42 * The TRACE method is used to invoke a remote, application-layer loop-
43 * back of the request message. The final recipient of the request
44 * SHOULD reflect the message received back to the client as the
45 * entity-body of a 200 (OK) response. The final recipient is either the
46 * origin server or the first proxy or gateway to receive a Max-Forwards
47 * value of zero (0) in the request (see section 14.31). A TRACE request
48 * MUST NOT include an entity.
49 * </blockquote>
50 * </p>
51 *
52 * @author Sean C. Sullivan
53 * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
54 * @author <a href="mailto:jsdever@apache.org">Jeff Dever</a>
55 *
56 * @version $Revision$
57 * @since 2.0
58 *
59 */
60 public class TraceMethod extends HttpMethodBase {
61
62
63
64 /***
65 * Constructor specifying a URI.
66 *
67 * @param uri either an absolute or relative URI
68 *
69 * @since 2.0
70 *
71 */
72 public TraceMethod(String uri) {
73 super(uri);
74 setFollowRedirects(false);
75 }
76
77
78
79 /***
80 * Returns <tt>"TRACE"</tt>.
81 *
82 * @return <tt>"TRACE"</tt>
83 *
84 * @since 2.0
85 *
86 */
87 public String getName() {
88 return "TRACE";
89 }
90
91 /***
92 * Recycles the HTTP method so that it can be used again.
93 * Note that all of the instance variables will be reset
94 * once this method has been called. This method will also
95 * release the connection being used by this HTTP method.
96 *
97 * @see #releaseConnection()
98 *
99 * @since 2.0
100 *
101 */
102 public void recycle() {
103 super.recycle();
104 setFollowRedirects(false);
105 }
106
107 }