View Javadoc

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