View Javadoc

1   /*
2    * $HeadURL: https://svn.apache.org/repos/asf/httpcomponents/oac.hc3x/trunk/src/java/org/apache/commons/httpclient/methods/TraceMethod.java $
3    * $Revision: 1425331 $
4    * $Date: 2012-12-22 18:29:41 +0000 (Sat, 22 Dec 2012) $
5    *
6    * ====================================================================
7    *
8    *  Licensed to the Apache Software Foundation (ASF) under one or more
9    *  contributor license agreements.  See the NOTICE file distributed with
10   *  this work for additional information regarding copyright ownership.
11   *  The ASF licenses this file to You under the Apache License, Version 2.0
12   *  (the "License"); you may not use this file except in compliance with
13   *  the License.  You may obtain a copy of the License at
14   *
15   *      http://www.apache.org/licenses/LICENSE-2.0
16   *
17   *  Unless required by applicable law or agreed to in writing, software
18   *  distributed under the License is distributed on an "AS IS" BASIS,
19   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   *  See the License for the specific language governing permissions and
21   *  limitations under the License.
22   * ====================================================================
23   *
24   * This software consists of voluntary contributions made by many
25   * individuals on behalf of the Apache Software Foundation.  For more
26   * information on the Apache Software Foundation, please see
27   * <http://www.apache.org/>.
28   *
29   */
30   
31  package org.apache.commons.httpclient.methods;
32  
33  import org.apache.commons.httpclient.HttpMethodBase;
34  
35  /***
36   * Implements the HTTP TRACE method.
37   * <p>
38   * The HTTP TRACE method is defined in section 9.6 of 
39   * <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC2616</a>:
40   * <blockquote>
41   *  The TRACE method is used to invoke a remote, application-layer loop-
42   *  back of the request message. The final recipient of the request
43   *  SHOULD reflect the message received back to the client as the
44   *  entity-body of a 200 (OK) response. The final recipient is either the
45   *  origin server or the first proxy or gateway to receive a Max-Forwards
46   *  value of zero (0) in the request (see section 14.31). A TRACE request
47   *  MUST NOT include an entity.
48   * </blockquote>
49   * </p>
50   *
51   * @author Sean C. Sullivan
52   * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
53   * @author <a href="mailto:jsdever@apache.org">Jeff Dever</a>
54   *
55   * @version $Revision: 1425331 $
56   * @since 2.0
57   * 
58   */
59  public class TraceMethod extends HttpMethodBase {
60  
61      //~ Constructors
62  
63      /***
64       * Constructor specifying a URI.
65       *
66       * @param uri either an absolute or relative URI
67       * 
68       * @since 2.0
69       * 
70       */
71      public TraceMethod(String uri) {
72          super(uri);
73          setFollowRedirects(false);
74      }
75  
76      //~ Methods
77  
78      /***
79       * Returns <tt>"TRACE"</tt>.
80       * 
81       * @return <tt>"TRACE"</tt>
82       * 
83       * @since 2.0
84       * 
85       */
86      public String getName() {
87          return "TRACE";
88      }
89  
90      /***
91       * Recycles the HTTP method so that it can be used again.
92       * Note that all of the instance variables will be reset
93       * once this method has been called. This method will also
94       * release the connection being used by this HTTP method.
95       * 
96       * @see #releaseConnection()
97       * 
98       * @since 2.0
99       * 
100      * @deprecated no longer supported and will be removed in the future
101      *             version of HttpClient
102      */
103     public void recycle() {
104         super.recycle();
105         setFollowRedirects(false);
106     }
107 
108 }