View Javadoc

1   /*
2    * $Header: $
3    * $Revision: $
4    * $Date: $
5    *
6    * ====================================================================
7    *
8    *  Copyright 1999-2004 The Apache Software Foundation
9    *
10   *  Licensed under the Apache License, Version 2.0 (the "License");
11   *  you may not use this file except in compliance with the License.
12   *  You may obtain a copy of the License at
13   *
14   *      http://www.apache.org/licenses/LICENSE-2.0
15   *
16   *  Unless required by applicable law or agreed to in writing, software
17   *  distributed under the License is distributed on an "AS IS" BASIS,
18   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   *  See the License for the specific language governing permissions and
20   *  limitations under the License.
21   * ====================================================================
22   *
23   * This software consists of voluntary contributions made by many
24   * individuals on behalf of the Apache Software Foundation.  For more
25   * information on the Apache Software Foundation, please see
26   * <http://www.apache.org/>.
27   *
28   * [Additional notices, if required by prior licensing conditions]
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      //~ Constructors
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      //~ Methods
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 }