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); }
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); }
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); }
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); }
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); }
protected static HttpPut getPut(String resource) throws Exception { HttpPut put = new HttpPut(AppFabricTestBase.getEndPoint(resource)); put.setHeader(AUTH_HEADER); return put; }