Example usage for org.apache.commons.httpclient.methods TraceMethod getStatusCode

List of usage examples for org.apache.commons.httpclient.methods TraceMethod getStatusCode

Introduction

In this page you can find the example usage for org.apache.commons.httpclient.methods TraceMethod getStatusCode.

Prototype

@Override
public int getStatusCode() 

Source Link

Document

Returns the response status code.

Usage

From source file:org.apache.camel.component.jetty.JettyEndpointSetHttpTraceTest.java

@Test
public void testTraceDisabled() throws Exception {
    HttpClient httpclient = new HttpClient();
    TraceMethod trace = new TraceMethod("http://localhost:" + portTraceOff + "/myservice");
    httpclient.executeMethod(trace);/*from  w  w w.  j  a va 2s  .  c  om*/

    // TRACE shouldn't be allowed by default
    assertTrue(trace.getStatusCode() == 405);
    trace.releaseConnection();
}

From source file:org.apache.camel.component.jetty.JettyEndpointSetHttpTraceTest.java

@Test
public void testTraceEnabled() throws Exception {
    HttpClient httpclient = new HttpClient();
    TraceMethod trace = new TraceMethod("http://localhost:" + portTraceOn + "/myservice");
    httpclient.executeMethod(trace);/* w ww. j a  v  a 2s . co  m*/

    // TRACE is now allowed
    assertTrue(trace.getStatusCode() == 200);
    trace.releaseConnection();
}