Package org.jboss.resteasy.client

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


        ClientRequest clientRequest =
                new ClientRequest(
                        PropertiesHolder.getProperty(Constants.zanataInstance
                                .value()) + path);
        clientRequest.header("X-Auth-User", TRANSLATOR);
        clientRequest.header("X-Auth-Token", TRANSLATOR_API);
        clientRequest.header("Content-Type", "application/xml");
        return clientRequest;
    }

    @Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
View Full Code Here


                new ClientRequest(
                        PropertiesHolder.getProperty(Constants.zanataInstance
                                .value()) + path);
        clientRequest.header("X-Auth-User", TRANSLATOR);
        clientRequest.header("X-Auth-Token", TRANSLATOR_API);
        clientRequest.header("Content-Type", "application/xml");
        return clientRequest;
    }

    @Test(timeout = ZanataTestCase.MAX_SHORT_TEST_DURATION)
    public void canOnlyDealWithKnownConfiguration() throws Exception {
View Full Code Here

      Customer cust = response.getEntity();

      String etag = response.getResponseHeaders().getFirst("ETag");
      System.out.println("Doing a conditional GET with ETag: " + etag);
      request.clear();
      request.header("If-None-Match", etag);
      response = request.get(Customer.class);
      Assert.assertEquals(304, response.getStatus());

      // Update and send a bad etag with conditional PUT
      cust.setCity("Bedford");
View Full Code Here

      Assert.assertEquals(304, response.getStatus());

      // Update and send a bad etag with conditional PUT
      cust.setCity("Bedford");
      request.clear();
      request.header("If-Match", "JUNK");
      request.body("application/xml", cust);
      ClientResponse response2 = request.put();
      Assert.assertEquals(412, response2.getStatus());
   }
}
View Full Code Here

  
   public void registerMessagingServiceCallback(String consumerKey, String callback)
   {
      ClientRequest request = new ClientRequest(MessagingServiceCallbackRegistrationURL);
      String base64Credentials = new String(Base64.encodeBytes("admin:admin".getBytes()));
      request.header("Authorization", "Basic " + base64Credentials);
      request.formParameter("consumer_id", consumerKey);
      request.formParameter("callback_uri", callback);
      ClientResponse<?> response = null;
      try {
         response = request.post();
View Full Code Here

  
   public void produceMessages()
    {
      ClientRequest request = new ClientRequest(MessagingServiceMessagesURL);
      String base64Credentials = new String(Base64.encodeBytes("admin:admin".getBytes()));
      request.header("Authorization", "Basic " + base64Credentials);
      request.body("text/plain", "Hello2 !");
      ClientResponse<?> response = null;
      try {
         response = request.post();
         if (HttpResponseCodes.SC_OK != response.getStatus()) {
View Full Code Here

  
   public String registerMessagingService(String consumerKey) throws Exception
   {
      ClientRequest request = new ClientRequest(ConsumerRegistrationURL);
      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()) {
View Full Code Here

  
   public void registerMessagingServiceScopes(String consumerKey, String scope) throws Exception
   {
      ClientRequest request = new ClientRequest(ConsumerScopesRegistrationURL);
      String base64Credentials = new String(Base64.encodeBytes("admin:admin".getBytes()));
      request.header("Authorization", "Basic " + base64Credentials);
      request.formParameter(OAuth.OAUTH_CONSUMER_KEY, consumerKey);
      request.formParameter("xoauth_scope", scope);
      request.formParameter("xoauth_permission", "sendMessages");
      ClientResponse<?> response = null;
      try {
View Full Code Here

   public void registerMessagingServiceCallback(String consumerKey, String consumerSecret, String callback)
       throws Exception
   {
      ClientRequest request = new ClientRequest(MessagingServiceCallbackRegistrationURL);
      String base64Credentials = new String(Base64.encodeBytes("admin:admin".getBytes()));
      request.header("Authorization", "Basic " + base64Credentials);
      request.formParameter("consumer_id", consumerKey);
      request.formParameter("consumer_secret", consumerSecret);
      request.formParameter("callback_uri", callback);
      ClientResponse<?> response = null;
      try {
View Full Code Here

   public void produceMessages()
      throws Exception
   {
      ClientRequest request = new ClientRequest(MessagingServiceMessagesURL);
      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()) {
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.