Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HttpMethod.releaseConnection()


            return null;
        } catch (Exception ex) {

            return null;
        } finally {
            method.releaseConnection();
        }
        return response;
    }

    /**
 
View Full Code Here


      // process response for each listener
      msg.getResponseBody().setLength(0);
      msg.getResponseBody().append(method.getResponseBody());
    } finally {
      if (method != null) {
        method.releaseConnection();
      }
    }

  }
View Full Code Here

          msg.getResponseBody().append(buf, len);
        }
      }
    } finally {
      if (method != null) {
        method.releaseConnection();
      }
    }
  }
}
View Full Code Here

            HttpClient client = new HttpClient();
            assertEquals(404, client.executeMethod(method));
            assertTrue(method.getResponseHeader("Content-Type").getValue()
                    .startsWith("text/plain"));
        } finally {
            method.releaseConnection();
        }

    }
}
View Full Code Here

                    throw populateHttpOperationFailedException(exchange, method, responseCode);
                }
            }

        } finally {
            method.releaseConnection();
        }
    }

    protected void populateResponse(Exchange exchange, HttpMethod method, Message in, HeaderFilterStrategy strategy, int responseCode) throws IOException {
        Message answer = exchange.getOut();
View Full Code Here

    String url = PROXY_URL+"?instanceid_key="+instance_id_key+"&url="+VALID_SITE_XML_URL;
    HttpClient client = new HttpClient();
    HttpMethod req = new GetMethod(url);
    client.executeMethod(req);
    int code = req.getStatusCode();
    req.releaseConnection();
    assertEquals(200,code);
    assertTrue(req.getResponseHeader("Content-Type").toString().contains("text/xml"));
  }
 
  /**
 
View Full Code Here

    String url = PROXY_URL+"?instanceid_key="+instance_id_key+"&url="+VALID_SITE_URL;
    HttpClient client = new HttpClient();
    HttpMethod req = new GetMethod(url);
    client.executeMethod(req);
    int code = req.getStatusCode();
    req.releaseConnection();
    assertEquals(200,code);
    assertTrue(req.getResponseHeader("Content-Type").toString().contains("text/html"));
  }
 
 
View Full Code Here

    HttpClient client = new HttpClient();
    HttpMethod req;
    req = new GetMethod(PROXY_URL+"?instanceid_key="+instance_id_key+"&url="+PROTECTED_SITE_URL);
    client.executeMethod(req);
    int code = req.getStatusCode();
    req.releaseConnection();
    assertEquals(401,code);
  }
 
  /**
   * Test that the proxy passes along credentials to the proxied site and is granted access
View Full Code Here

        new UsernamePasswordCredentials("java", "java"));   
    HttpMethod req;
    req = new GetMethod(PROXY_URL+"?instanceid_key="+instance_id_key+"&url="+PROTECTED_SITE_URL);
    client.executeMethod(req);
    int code = req.getStatusCode();
    req.releaseConnection();
    assertEquals(200,code);
  }

  /**
   * Utility method for sending requests
View Full Code Here

      } else {
        req = new GetMethod(url);
      }
      client.executeMethod(req);
      int code = req.getStatusCode();
      req.releaseConnection();
      return code;
    }
    catch (Exception e) {
      e.printStackTrace();
      fail("post failed");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.