Java Code Examples for org.apache.http.client.methods.HttpGet#setParams()

The following examples show how to use org.apache.http.client.methods.HttpGet#setParams() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UrlRewriteTest.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetServiceDocumentWithSlash() throws Exception {
  final HttpGet get = new HttpGet(URI.create(getEndpoint().toString()));
  final HttpParams params = new BasicHttpParams();
  params.setParameter("http.protocol.handle-redirects", false);
  get.setParams(params);

  final HttpResponse response = getHttpClient().execute(get);

  final String payload = StringHelper.inputStreamToString(response.getEntity().getContent());
  assertEquals("service document", payload);
  assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());
}
 
Example 2
Source File: UrlRewriteTest.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetMetadata() throws Exception {
  final HttpGet get = new HttpGet(URI.create(getEndpoint().toString() + "$metadata"));
  final HttpParams params = new BasicHttpParams();
  params.setParameter("http.protocol.handle-redirects", false);
  get.setParams(params);

  final HttpResponse response = getHttpClient().execute(get);

  final String payload = StringHelper.inputStreamToString(response.getEntity().getContent());
  assertEquals("metadata", payload);
  assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());
}
 
Example 3
Source File: UrlRewriteTest.java    From cloud-odata-java with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetServiceDocumentWithSlash() throws Exception {
  final HttpGet get = new HttpGet(URI.create(getEndpoint().toString()));
  final HttpParams params = new BasicHttpParams();
  params.setParameter("http.protocol.handle-redirects", false);
  get.setParams(params);

  final HttpResponse response = getHttpClient().execute(get);

  final String payload = StringHelper.inputStreamToString(response.getEntity().getContent());
  assertEquals("service document", payload);
  assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());
}
 
Example 4
Source File: UrlRewriteTest.java    From cloud-odata-java with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetMetadata() throws Exception {
  final HttpGet get = new HttpGet(URI.create(getEndpoint().toString() + "$metadata"));
  final HttpParams params = new BasicHttpParams();
  params.setParameter("http.protocol.handle-redirects", false);
  get.setParams(params);

  final HttpResponse response = getHttpClient().execute(get);

  final String payload = StringHelper.inputStreamToString(response.getEntity().getContent());
  assertEquals("metadata", payload);
  assertEquals(HttpStatusCodes.OK.getStatusCode(), response.getStatusLine().getStatusCode());
}