Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.TraceMethod


   
    public void testRecycle() {
        HttpClient client = new HttpClient();
      client.getHostConfiguration().setHost(host, port, "http");

        TraceMethod method = new TraceMethod("/");
       
        try {
            client.executeMethod(method);
        } catch (Throwable t) {
            t.printStackTrace();
            fail("Unable to execute method : " + t.toString());
        }

        try {
            String data = method.getResponseBodyAsString();
            assertTrue("No data returned.",(data.length() > 0));
        } catch (Throwable t) {
            t.printStackTrace();
            fail("Unable to execute method : " + t.toString());
        }

        method.recycle();
        method.setPath("/");

        try {
            client.executeMethod(method);
        } catch (Throwable t) {
            t.printStackTrace();
            fail("Unable to execute method : " + t.toString());
        }

        try {
            String data = method.getResponseBodyAsString();
            assertTrue("No data returned.",(data.length() > 0));
        } catch (Throwable t) {
            t.printStackTrace();
            fail("Unable to execute method : " + t.toString());
        }
View Full Code Here


      case POST:
        return new PostMethod(uri);
      case PUT:
        return new PutMethod(uri);
      case TRACE:
        return new TraceMethod(uri);
      default:
        throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
    }
  }
View Full Code Here

            case HEAD:
                method = new HeadMethod(path);
                break;

            case TRACE:
                method = new TraceMethod(path);
                break;

            default:
                throw new IllegalStateException("Submit method not yet supported: " + submitMethod);
        }
View Full Code Here

        case POST:    httpMethod = getMethod(new PostMethod(uri), entity); break;
        case PUT:     httpMethod = getMethod(new PutMethod(uri), entity); break;
        case DELETE:  httpMethod = new DeleteMethod(uri); break;
        case HEAD:    httpMethod = new HeadMethod(uri); break;
        case OPTIONS: httpMethod = new OptionsMethod(uri); break;
        case TRACE:   httpMethod = new TraceMethod(uri); break;
        default:      httpMethod = getMethod(new ExtensionMethod(method,uri), entity);
      }
      if (actual != null) {
        httpMethod.addRequestHeader("X-HTTP-Method-Override", actual.name());
      }
View Full Code Here

            DeleteMethod deleteMethod = new DeleteMethod(encodedPath);
            context.setHttpMethod(deleteMethod);
        }
        else if (ProxyConstants.METHOD_TRACE.equals(method))
        {
            TraceMethod traceMethod = new TraceMethod(encodedPath);
            context.setHttpMethod(traceMethod);
        }
        else
        {
            ProxyException pe = new ProxyException(INVALID_METHOD);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.methods.TraceMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.