Package org.apache.commons.httpclient.methods

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


       
    HttpClient httpClient = new HttpClient();
        PostMethod httpPostMethod = new PostMethod(u.toExternalForm());
        httpPostMethod.setRequestHeader("SOAPAction", "\"" + soapAction + "\"");
        httpPostMethod.setRequestHeader("Content-Type", "text/xml");
        httpPostMethod.setRequestEntity(new StringRequestEntity(request));
        httpClient.executeMethod(httpPostMethod);
        String result=httpPostMethod.getResponseBodyAsString();
   
    return(result);
  }
View Full Code Here


    PostMethod method = initialize(function, null);

    if (callData == null)
      callData = "";

    method.setRequestEntity(new StringRequestEntity(callData));
    // method.setRequestContentLength(callData.length());
    // method.setRequestBody(callData);

    return sendMessage(method);
  }
View Full Code Here

    }
  }

  public void sendString(String plain) {
    try {
      ((EntityEnclosingMethod)method).setRequestEntity(new StringRequestEntity(plain, "text/plain",
          "UTF-8"));
    }
    catch (UnsupportedEncodingException e) {
      throw new AssertionError(e);
    }
View Full Code Here

         Assert.assertEquals("basic", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         PutMethod method = new PutMethod("http://localhost:8080/spring-integration-test/basic");
         method.setRequestEntity(new StringRequestEntity("basic", "text/plain", null));
         int status = client.executeMethod(method);
         Assert.assertEquals(204, status);
         method.releaseConnection();
      }
      {
View Full Code Here

         Assert.assertEquals("basic", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         PutMethod method = new PutMethod("http://localhost:8080/spring-integration-test/locating/basic");
         method.setRequestEntity(new StringRequestEntity("basic", "text/plain", null));
         int status = client.executeMethod(method);
         Assert.assertEquals(204, status);
         method.releaseConnection();
      }
      {
View Full Code Here

         Assert.assertEquals("basic", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         PutMethod method = new PutMethod("http://localhost:8080/basic-integration-test/basic");
         method.setRequestEntity(new StringRequestEntity("basic", "text/plain", null));
         int status = client.executeMethod(method);
         Assert.assertEquals(204, status);
         method.releaseConnection();
      }
      {
View Full Code Here

         Assert.assertEquals("basic", method.getResponseBodyAsString());
         method.releaseConnection();
      }
      {
         PutMethod method = new PutMethod("http://localhost:8080/basic-integration-test/locating/basic");
         method.setRequestEntity(new StringRequestEntity("basic", "text/plain", null));
         int status = client.executeMethod(method);
         Assert.assertEquals(204, status);
         method.releaseConnection();
      }
      {
View Full Code Here

   public void testOneway() throws Exception
   {
      HttpClient client = new HttpClient();
      {
         PutMethod method = new PutMethod("http://localhost:9095/resource?oneway=true");
         method.setRequestEntity(new StringRequestEntity("content", "text/plain", null));
         int status = client.executeMethod(method);
         Assert.assertEquals(202, status);
         Thread.sleep(1500);
         GetMethod get = new GetMethod("http://localhost:9095/resource");
         status = client.executeMethod(get);
View Full Code Here

   public void testAsynch() throws Exception
   {
      HttpClient client = new HttpClient();
      {
         PostMethod method = new PostMethod("http://localhost:9095/resource?asynch=true");
         method.setRequestEntity(new StringRequestEntity("content", "text/plain", null));
         int status = client.executeMethod(method);
         Assert.assertEquals(Response.Status.ACCEPTED.getStatusCode(), status);
         String jobUrl1 = method.getResponseHeader(HttpHeaders.LOCATION).getValue();

         GetMethod get = new GetMethod(jobUrl1);
View Full Code Here

   
    public void sendMessage(String callbackURI, String messageSenderId, String message) {
        HttpClient client = new HttpClient();
        try {
            PostMethod method = new PostMethod(getPushMessageURL(callbackURI, messageSenderId));
            method.setRequestEntity(new StringRequestEntity(message, "text/plain", "UTF-8"));
            int status = client.executeMethod(method);
            if (HttpResponseCodes.SC_OK != status) {
               throw new RuntimeException("Message can not be delivered to subscribers");
            }
        } catch (Exception ex)
View Full Code Here

TOP

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

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.