hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1694621 - /httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/
Date Fri, 07 Aug 2015 07:34:47 GMT
Author: olegk
Date: Fri Aug  7 07:34:46 2015
New Revision: 1694621

URL: http://svn.apache.org/r1694621
Log:
Use httpbin.org in examples

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java
    httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java
Fri Aug  7 07:34:46 2015
@@ -39,7 +39,7 @@ public class ClientAbortMethod {
 
     public final static void main(String[] args) throws Exception {
         try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
-            HttpGet httpget = new HttpGet("http://www.apache.org/");
+            HttpGet httpget = new HttpGet("http://httpbin.org/get");
 
             System.out.println("Executing request " + httpget.getURI());
             try (CloseableHttpResponse response = httpclient.execute(httpget)) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java
Fri Aug  7 07:34:46 2015
@@ -44,12 +44,12 @@ public class ClientAuthentication {
     public static void main(String[] args) throws Exception {
         BasicCredentialsProvider credsProvider = new BasicCredentialsProvider();
         credsProvider.setCredentials(
-                new AuthScope("localhost", 443),
-                new UsernamePasswordCredentials("username", "password"));
+                new AuthScope("httpbin.org", 80),
+                new UsernamePasswordCredentials("user", "passwd"));
         try (CloseableHttpClient httpclient = HttpClients.custom()
                 .setDefaultCredentialsProvider(credsProvider)
                 .build()) {
-            HttpGet httpget = new HttpGet("http://localhost/");
+            HttpGet httpget = new HttpGet("http://httpbin.org/basic-auth/user/passwd");
 
             System.out.println("Executing request " + httpget.getRequestLine());
             try (CloseableHttpResponse response = httpclient.execute(httpget)) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java
Fri Aug  7 07:34:46 2015
@@ -48,7 +48,7 @@ public class ClientChunkEncodedPost {
             System.exit(1);
         }
         try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
-            HttpPost httppost = new HttpPost("http://localhost/");
+            HttpPost httppost = new HttpPost("http://httpbin.org/post");
 
             File file = new File(args[0]);
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
Fri Aug  7 07:34:46 2015
@@ -220,7 +220,7 @@ public class ClientConfiguration {
                 .setProxy(new HttpHost("myproxy", 8080))
                 .setDefaultRequestConfig(defaultRequestConfig)
                 .build()) {
-            HttpGet httpget = new HttpGet("http://www.apache.org/");
+            HttpGet httpget = new HttpGet("http://httpbin.org/get");
             // Request configuration can be overridden at the request level.
             // They will take precedence over the one set at the client level.
             RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig)

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
Fri Aug  7 07:34:46 2015
@@ -44,7 +44,7 @@ public class ClientConnectionRelease {
 
     public final static void main(String[] args) throws Exception {
         try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
-            HttpGet httpget = new HttpGet("http://localhost/");
+            HttpGet httpget = new HttpGet("http://httpbin.org/get");
 
             System.out.println("Executing request " + httpget.getRequestLine());
             try (CloseableHttpResponse response = httpclient.execute(httpget)) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java
Fri Aug  7 07:34:46 2015
@@ -55,7 +55,7 @@ public class ClientCustomContext {
             // Bind custom cookie store to the local context
             localContext.setCookieStore(cookieStore);
 
-            HttpGet httpget = new HttpGet("http://localhost/");
+            HttpGet httpget = new HttpGet("http://httpbin.org/cookies");
             System.out.println("Executing request " + httpget.getRequestLine());
 
             // Pass local context as a parameter

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java
Fri Aug  7 07:34:46 2015
@@ -72,7 +72,7 @@ public class ClientCustomPublicSuffixLis
                 .setDefaultCookieSpecRegistry(cookieSpecRegistry)
                 .build()) {
 
-            HttpGet httpget = new HttpGet("https://remotehost/");
+            HttpGet httpget = new HttpGet("https://httpbin.org/get");
 
             System.out.println("executing request " + httpget.getRequestLine());
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java
Fri Aug  7 07:34:46 2015
@@ -62,9 +62,9 @@ public class ClientCustomSSL {
                 .setSSLSocketFactory(sslsf)
                 .build()) {
 
-            HttpGet httpget = new HttpGet("https://localhost/");
+            HttpGet httpget = new HttpGet("https://httpbin.org/");
 
-            System.out.println("executing request " + httpget.getRequestLine());
+            System.out.println("Executing request " + httpget.getRequestLine());
 
             try (CloseableHttpResponse response = httpclient.execute(httpget)) {
                 HttpEntity entity = response.getEntity();

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
Fri Aug  7 07:34:46 2015
@@ -44,13 +44,13 @@ public class ClientExecuteProxy {
 
     public static void main(String[] args)throws Exception {
         try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
-            HttpHost target = new HttpHost("localhost", 443, "https");
+            HttpHost target = new HttpHost("httpbin.org", 443, "https");
             HttpHost proxy = new HttpHost("127.0.0.1", 8080, "http");
 
             RequestConfig config = RequestConfig.custom()
                     .setProxy(proxy)
                     .build();
-            HttpGet request = new HttpGet("/");
+            HttpGet request = new HttpGet("/get");
             request.setConfig(config);
 
             System.out.println("Executing request " + request.getRequestLine() + " to " +
target + " via " + proxy);

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java
Fri Aug  7 07:34:46 2015
@@ -66,8 +66,8 @@ public class ClientExecuteSOCKS {
             HttpClientContext context = HttpClientContext.create();
             context.setAttribute("socks.address", socksaddr);
 
-            HttpHost target = new HttpHost("localhost", 80, "http");
-            HttpGet request = new HttpGet("/");
+            HttpHost target = new HttpHost("httpbin.org", 80, "http");
+            HttpGet request = new HttpGet("/get");
 
             System.out.println("Executing request " + request + " to " + target + " via SOCKS
proxy " + socksaddr);
             try (CloseableHttpResponse response = httpclient.execute(target, request, context))
{

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java
Fri Aug  7 07:34:46 2015
@@ -27,6 +27,7 @@
 package org.apache.http.examples.client;
 
 import org.apache.http.HttpHost;
+import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.client.AuthCache;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -34,6 +35,7 @@ import org.apache.http.client.methods.Ht
 import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.impl.auth.BasicScheme;
 import org.apache.http.impl.client.BasicAuthCache;
+import org.apache.http.impl.client.BasicCredentialsProvider;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
@@ -49,28 +51,26 @@ import org.apache.http.util.EntityUtils;
 public class ClientPreemptiveBasicAuthentication {
 
     public static void main(String[] args) throws Exception {
-        HttpHost target = new HttpHost("localhost", 80, "http");
         try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
 
-            // Create AuthCache instance
-            AuthCache authCache = new BasicAuthCache();
             // Generate BASIC scheme object and add it to the local auth cache
             BasicScheme basicAuth = new BasicScheme();
-            basicAuth.initPreemptive(new UsernamePasswordCredentials("username", "password"));
-            authCache.put(target, basicAuth);
+            basicAuth.initPreemptive(new UsernamePasswordCredentials("user", "passwd"));
+
+            HttpHost target = new HttpHost("httpbin.org", 80, "http");
 
             // Add AuthCache to the execution context
             HttpClientContext localContext = HttpClientContext.create();
-            localContext.setAuthCache(authCache);
+            localContext.resetAuthExchange(target, basicAuth);
 
-            HttpGet httpget = new HttpGet("/");
+            HttpGet httpget = new HttpGet("http://httpbin.org/hidden-basic-auth/user/passwd");
 
             System.out.println("Executing request " + httpget.getRequestLine() + " to target
" + target);
             for (int i = 0; i < 3; i++) {
-                try (CloseableHttpResponse response = httpclient.execute(target, httpget,
localContext)) {
+                try (CloseableHttpResponse response = httpclient.execute(httpget, localContext))
{
                     System.out.println("----------------------------------------");
                     System.out.println(response.getStatusLine());
-                    EntityUtils.consume(response.getEntity());
+                    System.out.println(EntityUtils.toString(response.getEntity()));
                 }
             }
         }

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java
Fri Aug  7 07:34:46 2015
@@ -27,6 +27,7 @@
 package org.apache.http.examples.client;
 
 import org.apache.http.HttpHost;
+import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.client.AuthCache;
 import org.apache.http.client.methods.CloseableHttpResponse;
@@ -34,6 +35,7 @@ import org.apache.http.client.methods.Ht
 import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.impl.auth.DigestScheme;
 import org.apache.http.impl.client.BasicAuthCache;
+import org.apache.http.impl.client.BasicCredentialsProvider;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
@@ -50,7 +52,6 @@ import org.apache.http.util.EntityUtils;
 public class ClientPreemptiveDigestAuthentication {
 
     public static void main(String[] args) throws Exception {
-        HttpHost target = new HttpHost("localhost", 80, "http");
         try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
 
             // Create AuthCache instance
@@ -58,14 +59,16 @@ public class ClientPreemptiveDigestAuthe
             // Generate DIGEST scheme object, initialize it and add it to the local auth
cache
             DigestScheme digestAuth = new DigestScheme();
             // Suppose we already know the realm name and the expected nonce value
-            digestAuth.initPreemptive(new UsernamePasswordCredentials("username", "password"),
"whatever", "realm");
+            digestAuth.initPreemptive(new UsernamePasswordCredentials("user", "passwd"),
"whatever", "realm");
+
+            HttpHost target = new HttpHost("httpbin.org", 80, "http");
             authCache.put(target, digestAuth);
 
             // Add AuthCache to the execution context
             HttpClientContext localContext = HttpClientContext.create();
             localContext.setAuthCache(authCache);
 
-            HttpGet httpget = new HttpGet("/");
+            HttpGet httpget = new HttpGet("http://httpbin.org/digest-auth/auth/user/passwd");
 
             System.out.println("Executing request " + httpget.getRequestLine() + " to target
" + target);
             for (int i = 0; i < 3; i++) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
Fri Aug  7 07:34:46 2015
@@ -46,17 +46,20 @@ public class ClientProxyAuthentication {
     public static void main(String[] args) throws Exception {
         BasicCredentialsProvider credsProvider = new BasicCredentialsProvider();
         credsProvider.setCredentials(
-                new AuthScope("localhost", 8080),
-                new UsernamePasswordCredentials("username", "password"));
+                new AuthScope("localhost", 8888),
+                new UsernamePasswordCredentials("squid", "squid"));
+        credsProvider.setCredentials(
+                new AuthScope("httpbin.org", 80),
+                new UsernamePasswordCredentials("user", "passwd"));
         try (CloseableHttpClient httpclient = HttpClients.custom()
                 .setDefaultCredentialsProvider(credsProvider).build()) {
-            HttpHost target = new HttpHost("www.verisign.com", 443, "https");
-            HttpHost proxy = new HttpHost("localhost", 8080);
+            HttpHost target = new HttpHost("httpbin.org", 80, "http");
+            HttpHost proxy = new HttpHost("localhost", 8888);
 
             RequestConfig config = RequestConfig.custom()
-                    .setProxy(proxy)
-                    .build();
-            HttpGet httpget = new HttpGet("/");
+                .setProxy(proxy)
+                .build();
+            HttpGet httpget = new HttpGet("/basic-auth/user/passwd");
             httpget.setConfig(config);
 
             System.out.println("Executing request " + httpget.getRequestLine() + " to " +
target + " via " + proxy);

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java
Fri Aug  7 07:34:46 2015
@@ -63,7 +63,7 @@ public class ClientWithRequestFuture {
             };
 
             // Simple request ...
-            HttpGet request1 = new HttpGet("http://google.com");
+            HttpGet request1 = new HttpGet("http://httpbin.org/get");
             HttpRequestFutureTask<Boolean> futureTask1 = requestExecService.execute(request1,
                     HttpClientContext.create(), handler);
             Boolean wasItOk1 = futureTask1.get();
@@ -71,7 +71,7 @@ public class ClientWithRequestFuture {
 
             // Cancel a request
             try {
-                HttpGet request2 = new HttpGet("http://google.com");
+                HttpGet request2 = new HttpGet("http://httpbin.org/get");
                 HttpRequestFutureTask<Boolean> futureTask2 = requestExecService.execute(request2,
                         HttpClientContext.create(), handler);
                 futureTask2.cancel(true);
@@ -82,7 +82,7 @@ public class ClientWithRequestFuture {
             }
 
             // Request with a timeout
-            HttpGet request3 = new HttpGet("http://google.com");
+            HttpGet request3 = new HttpGet("http://httpbin.org/get");
             HttpRequestFutureTask<Boolean> futureTask3 = requestExecService.execute(request3,
                     HttpClientContext.create(), handler);
             Boolean wasItOk3 = futureTask3.get(10, TimeUnit.SECONDS);
@@ -106,7 +106,7 @@ public class ClientWithRequestFuture {
             };
 
             // Simple request with a callback
-            HttpGet request4 = new HttpGet("http://google.com");
+            HttpGet request4 = new HttpGet("http://httpbin.org/get");
             // using a null HttpContext here since it is optional
             // the callback will be called when the task completes, fails, or is cancelled
             HttpRequestFutureTask<Boolean> futureTask4 = requestExecService.execute(request4,

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java
Fri Aug  7 07:34:46 2015
@@ -46,7 +46,7 @@ public class ClientWithResponseHandler {
 
     public final static void main(String[] args) throws Exception {
         try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
-            HttpGet httpget = new HttpGet("http://localhost/");
+            HttpGet httpget = new HttpGet("http://httpbin.org/get");
 
             System.out.println("Executing request " + httpget.getRequestLine());
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java?rev=1694621&r1=1694620&r2=1694621&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java
Fri Aug  7 07:34:46 2015
@@ -44,7 +44,7 @@ public class QuickStart {
 
     public static void main(String[] args) throws Exception {
         try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
-            HttpGet httpGet = new HttpGet("http://targethost/homepage");
+            HttpGet httpGet = new HttpGet("http://httpbin.org/get");
             // The underlying HTTP connection is still held by the response object
             // to allow the response content to be streamed directly from the network socket.
             // In order to ensure correct deallocation of system resources
@@ -60,7 +60,7 @@ public class QuickStart {
                 EntityUtils.consume(entity1);
             }
 
-            HttpPost httpPost = new HttpPost("http://targethost/login");
+            HttpPost httpPost = new HttpPost("http://httpbin.org/post");
             List<NameValuePair> nvps = new ArrayList<>();
             nvps.add(new BasicNameValuePair("username", "vip"));
             nvps.add(new BasicNameValuePair("password", "secret"));



Mime
View raw message