Package org.apache.commons.httpclient.methods

Examples of org.apache.commons.httpclient.methods.PostMethod.addRequestHeader()


      {
          HttpClient client = new HttpClient();
          PostMethod method = new PostMethod(MessagingServiceCallbackRegistrationURL);
          Base64 base64 = new Base64();
          String base64Credentials = new String(base64.encode("admin:admin".getBytes()));
          method.addRequestHeader(new Header("Authorization", "Basic " + base64Credentials));
          method.addParameter("consumer_id", consumerKey);
          method.addParameter("callback_uri", callback);
          int status = client.executeMethod(method);
          if (HttpResponseCodes.SC_OK != status) {
              throw new RuntimeException("Callback Registration failed");
View Full Code Here


       try {
           HttpClient client = new HttpClient();
           PostMethod method = new PostMethod(MessagingServiceMessagesURL);
           Base64 base64 = new Base64();
           String base64Credentials = new String(base64.encode("admin:admin".getBytes()));
           method.addRequestHeader(new Header("Authorization", "Basic " + base64Credentials));
           method.setRequestEntity(new StringRequestEntity("Hello2 !", "text/plain", "UTF-8"));
           int status = client.executeMethod(method);
           if (HttpResponseCodes.SC_OK != status) {
               throw new RuntimeException("Messages can not be sent");
           }
View Full Code Here

   {
      HttpClient client = new HttpClient();
      PostMethod method = new PostMethod(ConsumerRegistrationURL);
      Base64 base64 = new Base64();
      String base64Credentials = new String(base64.encode("admin:admin".getBytes()));
      method.addRequestHeader(new Header("Authorization", "Basic " + base64Credentials));
      method.addParameter(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
      int status = client.executeMethod(method);
      if (HttpResponseCodes.SC_OK != status) {
          throw new RuntimeException("Registration failed");
      }
View Full Code Here

   {
       HttpClient client = new HttpClient();
       PostMethod method = new PostMethod(ConsumerScopesRegistrationURL);
       Base64 base64 = new Base64();
       String base64Credentials = new String(base64.encode("admin:admin".getBytes()));
       method.addRequestHeader(new Header("Authorization", "Basic " + base64Credentials));
       method.addParameter(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
       method.addParameter("xoauth_scope", scope);
       method.addParameter("xoauth_permission", "sendMessages");
       int status = client.executeMethod(method);
       if (HttpResponseCodes.SC_OK != status) {
View Full Code Here

   {
      HttpClient client = new HttpClient();
      PostMethod method = new PostMethod(MessagingServiceCallbackRegistrationURL);
      Base64 base64 = new Base64();
      String base64Credentials = new String(base64.encode("admin:admin".getBytes()));
      method.addRequestHeader(new Header("Authorization", "Basic " + base64Credentials));
      method.addParameter("consumer_id", consumerKey);
      method.addParameter("consumer_secret", consumerSecret);
      method.addParameter("callback_uri", callback);
      int status = client.executeMethod(method);
      if (HttpResponseCodes.SC_OK != status) {
View Full Code Here

   {
      HttpClient client = new HttpClient();
      PostMethod method = new PostMethod(MessagingServiceMessagesURL);
      Base64 base64 = new Base64();
      String base64Credentials = new String(base64.encode("admin:admin".getBytes()));
      method.addRequestHeader(new Header("Authorization", "Basic " + base64Credentials));
      method.setRequestEntity(new StringRequestEntity("Hello !", "text/plain", "UTF-8"));
      int status = client.executeMethod(method);
      if (HttpResponseCodes.SC_OK != status) {
          throw new RuntimeException("Messages can not be sent");
      }
View Full Code Here

     
      String strURL = openxg_wrapper_url.getConf_value();
     
      // Prepare HTTP post
          PostMethod post = new PostMethod(strURL);
          post.addRequestHeader("User-Agent", "OpenSIPg XML_RPC Client");

          //Get the XML-String representative
          String stringToPost = OpenXGCustomXMLMarshall.getInstance().
                      openSIPgCreateConference(client_id, digest, "067201101", domain,
                                    ""+starttime, ""+endTime,
View Full Code Here

         
      String strURL = openxg_wrapper_url.getConf_value();
     
      // Prepare HTTP post
          PostMethod post = new PostMethod(strURL);
          post.addRequestHeader("User-Agent", "OpenSIPg XML_RPC Client");

         
         
          //log.debug(stringToPost);
         
View Full Code Here

    public void testGetPlainLong() throws Exception {
        String endpointAddress =
            "http://localhost:" + PORT + "/bookstore/booksplain";

        PostMethod post = new PostMethod(endpointAddress);
        post.addRequestHeader("Content-Type" , "text/plain");
        post.addRequestHeader("Accept" , "text/plain");
        post.setRequestBody("12345");
        HttpClient httpclient = new HttpClient();
       
        try {
View Full Code Here

        String endpointAddress =
            "http://localhost:" + PORT + "/bookstore/booksplain";

        PostMethod post = new PostMethod(endpointAddress);
        post.addRequestHeader("Content-Type" , "text/plain");
        post.addRequestHeader("Accept" , "text/plain");
        post.setRequestBody("12345");
        HttpClient httpclient = new HttpClient();
       
        try {
            int result = httpclient.executeMethod(post);
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.