Exemple #1
0
 protected static HttpResponse doPut(String resource, String body) throws Exception {
   DefaultHttpClient client = new DefaultHttpClient();
   HttpPut put = new HttpPut(AppFabricTestBase.getEndPoint(resource));
   if (body != null) {
     put.setEntity(new StringEntity(body));
   }
   put.setHeader(AUTH_HEADER);
   return client.execute(put);
 }
Exemple #2
0
  protected static HttpResponse doGet(String resource, Header[] headers) throws Exception {
    DefaultHttpClient client = new DefaultHttpClient();
    HttpGet get = new HttpGet(AppFabricTestBase.getEndPoint(resource));

    if (headers != null) {
      get.setHeaders(ObjectArrays.concat(AUTH_HEADER, headers));
    } else {
      get.setHeader(AUTH_HEADER);
    }
    return client.execute(get);
  }
Exemple #3
0
  protected static HttpResponse doPost(String resource, String body, Header[] headers)
      throws Exception {
    DefaultHttpClient client = new DefaultHttpClient();
    HttpPost post = new HttpPost(AppFabricTestBase.getEndPoint(resource));

    if (body != null) {
      post.setEntity(new StringEntity(body));
    }

    if (headers != null) {
      post.setHeaders(ObjectArrays.concat(AUTH_HEADER, headers));
    } else {
      post.setHeader(AUTH_HEADER);
    }
    return client.execute(post);
  }
Exemple #4
0
 protected static HttpResponse doDelete(String resource) throws Exception {
   DefaultHttpClient client = new DefaultHttpClient();
   HttpDelete delete = new HttpDelete(AppFabricTestBase.getEndPoint(resource));
   delete.setHeader(AUTH_HEADER);
   return client.execute(delete);
 }
Exemple #5
0
 protected static HttpResponse doPut(String resource) throws Exception {
   DefaultHttpClient client = new DefaultHttpClient();
   HttpPut put = new HttpPut(AppFabricTestBase.getEndPoint(resource));
   put.setHeader(AUTH_HEADER);
   return doPut(resource, null);
 }
Exemple #6
0
 protected static HttpPut getPut(String resource) throws Exception {
   HttpPut put = new HttpPut(AppFabricTestBase.getEndPoint(resource));
   put.setHeader(AUTH_HEADER);
   return put;
 }