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