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 package org.apache.commons.httpclient.methods;
32
33 import org.apache.commons.httpclient.HttpMethodBase;
34 import org.apache.commons.logging.Log;
35 import org.apache.commons.logging.LogFactory;
36
37 /***
38 * Implements the HTTP GET method.
39 * <p>
40 * The HTTP GET method is defined in section 9.3 of
41 * <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>:
42 * <blockquote>
43 * The GET method means retrieve whatever information (in the form of an
44 * entity) is identified by the Request-URI. If the Request-URI refers
45 * to a data-producing process, it is the produced data which shall be
46 * returned as the entity in the response and not the source text of the
47 * process, unless that text happens to be the output of the process.
48 * </blockquote>
49 * </p>
50 * <p>
51 * GetMethods will follow redirect requests from the http server by default.
52 * This behavour can be disabled by calling setFollowRedirects(false).</p>
53 *
54 * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
55 * @author Sung-Gu Park
56 * @author Sean C. Sullivan
57 * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
58 * @author <a href="mailto:jsdever@apache.org">Jeff Dever</a>
59 *
60 * @version $Revision$
61 * @since 1.0
62 */
63 public class GetMethod extends HttpMethodBase {
64
65
66
67 /*** Log object for this class. */
68 private static final Log LOG = LogFactory.getLog(GetMethod.class);
69
70
71
72 /***
73 * No-arg constructor.
74 *
75 * @since 1.0
76 */
77 public GetMethod() {
78 setFollowRedirects(true);
79 }
80
81 /***
82 * Constructor specifying a URI.
83 *
84 * @param uri either an absolute or relative URI
85 *
86 * @since 1.0
87 */
88 public GetMethod(String uri) {
89 super(uri);
90 LOG.trace("enter GetMethod(String)");
91 setFollowRedirects(true);
92 }
93
94
95
96 /***
97 * Returns <tt>"GET"</tt>.
98 *
99 * @return <tt>"GET"</tt>
100 *
101 * @since 2.0
102 */
103 public String getName() {
104 return "GET";
105 }
106
107
108
109 /***
110 * Recycles the HTTP method so that it can be used again.
111 * Note that all of the instance variables will be reset
112 * once this method has been called. This method will also
113 * release the connection being used by this HTTP method.
114 *
115 * @see #releaseConnection()
116 *
117 * @since 1.0
118 *
119 * @deprecated no longer supported and will be removed in the future
120 * version of HttpClient
121 */
122 public void recycle() {
123 LOG.trace("enter GetMethod.recycle()");
124
125 super.recycle();
126 setFollowRedirects(true);
127 }
128
129 }