001: /*
002: * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/java/org/apache/commons/httpclient/methods/GetMethod.java,v 1.29 2004/06/13 20:22:19 olegk Exp $
003: * $Revision: 480424 $
004: * $Date: 2006-11-29 06:56:49 +0100 (Wed, 29 Nov 2006) $
005: *
006: * ====================================================================
007: *
008: * Licensed to the Apache Software Foundation (ASF) under one or more
009: * contributor license agreements. See the NOTICE file distributed with
010: * this work for additional information regarding copyright ownership.
011: * The ASF licenses this file to You under the Apache License, Version 2.0
012: * (the "License"); you may not use this file except in compliance with
013: * the License. You may obtain a copy of the License at
014: *
015: * http://www.apache.org/licenses/LICENSE-2.0
016: *
017: * Unless required by applicable law or agreed to in writing, software
018: * distributed under the License is distributed on an "AS IS" BASIS,
019: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
020: * See the License for the specific language governing permissions and
021: * limitations under the License.
022: * ====================================================================
023: *
024: * This software consists of voluntary contributions made by many
025: * individuals on behalf of the Apache Software Foundation. For more
026: * information on the Apache Software Foundation, please see
027: * <http://www.apache.org/>.
028: *
029: */
030:
031: package org.apache.commons.httpclient.methods;
032:
033: import org.apache.commons.httpclient.HttpMethodBase;
034: import org.apache.commons.logging.Log;
035: import org.apache.commons.logging.LogFactory;
036:
037: /**
038: * Implements the HTTP GET method.
039: * <p>
040: * The HTTP GET method is defined in section 9.3 of
041: * <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>:
042: * <blockquote>
043: * The GET method means retrieve whatever information (in the form of an
044: * entity) is identified by the Request-URI. If the Request-URI refers
045: * to a data-producing process, it is the produced data which shall be
046: * returned as the entity in the response and not the source text of the
047: * process, unless that text happens to be the output of the process.
048: * </blockquote>
049: * </p>
050: * <p>
051: * GetMethods will follow redirect requests from the http server by default.
052: * This behavour can be disabled by calling setFollowRedirects(false).</p>
053: *
054: * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
055: * @author Sung-Gu Park
056: * @author Sean C. Sullivan
057: * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
058: * @author <a href="mailto:jsdever@apache.org">Jeff Dever</a>
059: *
060: * @version $Revision: 480424 $
061: * @since 1.0
062: */
063: public class GetMethod extends HttpMethodBase {
064:
065: // -------------------------------------------------------------- Constants
066:
067: /** Log object for this class. */
068: private static final Log LOG = LogFactory.getLog(GetMethod.class);
069:
070: // ----------------------------------------------------------- Constructors
071:
072: /**
073: * No-arg constructor.
074: *
075: * @since 1.0
076: */
077: public GetMethod() {
078: setFollowRedirects(true);
079: }
080:
081: /**
082: * Constructor specifying a URI.
083: *
084: * @param uri either an absolute or relative URI
085: *
086: * @since 1.0
087: */
088: public GetMethod(String uri) {
089: super (uri);
090: LOG.trace("enter GetMethod(String)");
091: setFollowRedirects(true);
092: }
093:
094: // --------------------------------------------------------- Public Methods
095:
096: /**
097: * Returns <tt>"GET"</tt>.
098: *
099: * @return <tt>"GET"</tt>
100: *
101: * @since 2.0
102: */
103: public String getName() {
104: return "GET";
105: }
106:
107: // ------------------------------------------------------------- Properties
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: }
|