Package org.jboss.resteasy.client

Examples of org.jboss.resteasy.client.ClientRequest.post()


      String base64Credentials = new String(Base64.encodeBytes("admin:admin".getBytes()));
      request.header("Authorization", "Basic " + base64Credentials);
      request.formParameter(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
      ClientResponse<String> response = null;
      try {
         response = request.post(String.class);
         if (HttpResponseCodes.SC_OK != response.getStatus()) {
            throw new RuntimeException("Registration failed");
         }
         // check that we got all tokens
         Map<String, String> tokens = OAuth.newMap(OAuth.decodeForm(response.getEntity()));
View Full Code Here


      request.formParameter(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
      request.formParameter("xoauth_scope", scope);
      request.formParameter("xoauth_permission", "sendMessages");
      ClientResponse<?> response = null;
      try {
         response = request.post();
         if (HttpResponseCodes.SC_OK != response.getStatus()) {
            throw new RuntimeException("Scopes can not be registered");
         }
      } finally {
         response.releaseConnection();
View Full Code Here

      request.formParameter("consumer_id", consumerKey);
      request.formParameter("consumer_secret", consumerSecret);
      request.formParameter("callback_uri", callback);
      ClientResponse<?> response = null;
      try {
         response = request.post();
         if (HttpResponseCodes.SC_OK != response.getStatus()) {
            throw new RuntimeException("Callback Registration failed");
        }
      } finally {
         response.releaseConnection();
View Full Code Here

      String base64Credentials = new String(Base64.encodeBytes("admin:admin".getBytes()));
      request.header("Authorization", "Basic " + base64Credentials);
      request.body("text/plain", "Hello !");
      ClientResponse<?> response = null;
      try {
         response = request.post();
         if (HttpResponseCodes.SC_OK != response.getStatus()) {
            throw new RuntimeException("Messages can not be sent");
         }
      } finally {
         response.releaseConnection();
View Full Code Here

   public String registerMessagingService(String consumerKey) throws Exception
   {
      ClientRequest request = new ClientRequest(ConsumerRegistrationURL);
      request.header("Authorization", "OpenId " + SubscriberOpenIdIdentifier);
      request.formParameter(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
      ClientResponse<String> response = request.post(String.class);
      if (HttpResponseCodes.SC_OK != response.getStatus()) {
         throw new RuntimeException("Registration failed");
      }
      // check that we got all tokens
      Map<String, String> tokens = OAuth.newMap(OAuth.decodeForm(response.getEntity()));
View Full Code Here

      ClientRequest request = new ClientRequest(ConsumerScopesRegistrationURL);
      request.header("Authorization", "OpenId " + SubscriberOpenIdIdentifier);
      request.formParameter(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
      request.formParameter("xoauth_scope", scope);
      request.formParameter("xoauth_permission", "sendMessages");
      ClientResponse<?> response = request.post();
      response.releaseConnection();
      if (HttpResponseCodes.SC_OK != response.getStatus()) {
         throw new RuntimeException("Scopes can not be registered");
      }
   }
View Full Code Here

      ClientRequest request = new ClientRequest(MessagingServiceCallbackRegistrationURL);
      request.header("Authorization", "OpenId " + SubscriberOpenIdIdentifier);
      request.formParameter("consumer_id", consumerKey);
      request.formParameter("consumer_secret", consumerSecret);
      request.formParameter("callback_uri", callback);
      ClientResponse<?> response = request.post();
      response.releaseConnection();
      if (HttpResponseCodes.SC_OK != response.getStatus()) {
         throw new RuntimeException("Callback Registration failed");
      }
   }
View Full Code Here

      {
         // Null query parameter
         ClientRequest request = new ClientRequest(generateURL("/post"));
         request.accept(MediaType.APPLICATION_XML);
         ClientResponse<?> response = request.post();
         ViolationReport report = response.getEntity(ViolationReport.class);
         System.out.println("report: " + report.toString());
         countViolations(report, 1, 0, 0, 0, 1, 0);
      }
View Full Code Here

      ClientRequest request = new ClientRequest(TestPortProvider.generateURL("/test/string"));
      Customer cust = new Customer();
      String name = "bill\u00E9";
      cust.setName(name);
      request.body("application/xml", cust);
      request.post();


   }
   @Test
   public void testCase() throws Exception
View Full Code Here

      System.out.println("client name: " + name);

      System.out.println("bytes string: " + new String(name.getBytes("UTF-8"), "UTF-8"));
      cust.setName(name);
      request.body("application/xml", cust);
      request.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.