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