Package org.jboss.resteasy.client

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


      System.out.println();
      System.out.println("** Create an order through this URL: " + orders.getHref());
      request = new ClientRequest(orders.getHref());
      request.body("application/xml", order);
      response = request.post();
      Assert.assertEquals(201, response.getStatus());
      String createdOrderUrl = (String) response.getHeaders().getFirst("Location");

      System.out.println();
      System.out.println("** New list of orders");
View Full Code Here


   {
      ClientRequest request = new ClientRequest(ConsumerRegistrationURL);
      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

   {
      String url = getRequestURL(consumerKey, consumerSecret, callbackURI, scope, permission);
      ClientRequest request = new ClientRequest(url);
      ClientResponse<String> response = null;
      try {
         response = request.post(String.class);
         if (HttpResponseCodes.SC_OK != response.getStatus()) {
            throw new RuntimeException("Request token can not be obtained");
         }
         // check that we got all tokens
         Map<String, String> tokens = getResponse(response);
View Full Code Here

                                requestToken.getToken(), requestToken.getSecret(),
                                requestToken.getVerifier());
      ClientRequest request = new ClientRequest(url);
      ClientResponse<String> response = null;
      try {
         response = request.post(String.class);
         if (HttpResponseCodes.SC_OK != response.getStatus()) {
            throw new RuntimeException("Request token can not be obtained");
        }
        // check that we got all tokens
        Map<String, String> tokens = getResponse(response);
View Full Code Here

  {
     String url = getEndUserURL("/resource1", DEFAULT_CONSUMER_ID, consumerSecret, accessToken.getToken(), accessToken.getSecret());
     ClientRequest request = new ClientRequest(url);
     ClientResponse<String> response = null;
     try {
        response = request.post(String.class);
        if (200 != response.getStatus()) {
           throw new RuntimeException("Unexpected status");
        }
        return response.getEntity();
     } finally {
View Full Code Here

    {
       String url = getEndUserURL("/resource2", DEFAULT_CONSUMER_ID, consumerSecret, accessToken.getToken(), accessToken.getSecret());
       ClientRequest request = new ClientRequest(url);
       ClientResponse<?> response = null;
       try {
          response = request.post();
          if (401 != response.getStatus()) {
             throw new RuntimeException("Unexpected status");
          }
       } finally {
          response.releaseConnection();
View Full Code Here

      ClientRequest request = new ClientRequest(url);
      String base64Credentials = new String(Base64.encodeBytes("admin:admin".getBytes()));
      request.header("Authorization", "Basic " + base64Credentials);
      ClientResponse<String> response = null;
      try {
         response = request.post(String.class);
         if (302 != response.getStatus()) {
            throw new RuntimeException("Initiation failed");
        }
        // check that we got all tokens
        String callbackURI = response.getResponseHeaders().getFirst("Location");
View Full Code Here

   public String setCallback(String url) throws Exception
   {
      ClientRequest request = new ClientRequest(url);
      ClientResponse<String> response = null;
      try {
         response = request.post(String.class);
         if (200 != response.getStatus()) {
            throw new RuntimeException("Service failed");
        }
        return response.getEntity();
      } finally {
View Full Code Here

    //Simple ClientRequest invocation
    ClientRequest request = new ClientRequest("http://localhost:8080/sampleRest");
    request.accept("application/json");
    request.body("application/json", obj);
    ClientResponse<String> response = request.post(String.class);
    String t = response.getEntity();
    System.out.println("testRestClientRequestSendString: " + t);

    //Proxy example
    EscapedCharTest proxy = ProxyFactory.create(
View Full Code Here

         {
            try
            {
               ClientRequest request = new ClientRequest(generateURL("/kunde"));
               request.body("application/xml", kundeXml);
               ClientResponse<?> response = request.post();
               Assert.assertEquals(204, response.getStatus());
               response.releaseConnection();
            }
            catch (IOException e)
            {
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.