GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Decodo/java/java.java at master · Decodo/Decodo Expand file tree/ Copy pathjava.javaMore file actions 53 lines (47 loc) · 1.9 KB / Copy pathjava.javaFile metadata and controls53 lines (47 loc) · 1.9 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 // I compiled the code using Maven with: mvn clean compile // Then ran it with: exec:java -Dexec.mainClass="example.Example" package example; import java.io.*; import java.util.Random; import org.apache.http.HttpHost; import org.apache.http.auth.*; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.fluent.Request; import org.apache.http.client.methods.*; import org.apache.http.impl.client.*; import org.apache.http.impl.conn.BasicHttpClientConnectionManager; import org.apache.http.util.EntityUtils; class Client { public static final String username = "username"; public static final String password = "password"; public static final int port = 7000; public CloseableHttpClient client; public Client(String country) { HttpHost proxy = new HttpHost("gate.decodo.com", port); CredentialsProvider cred_provider = new BasicCredentialsProvider(); cred_provider.setCredentials(new AuthScope(proxy), new UsernamePasswordCredentials(username, password)); client = HttpClients.custom() .setConnectionManager(new BasicHttpClientConnectionManager()) .setProxy(proxy) .setDefaultCredentialsProvider(cred_provider) .build(); } public String request(String url) throws IOException { HttpGet request = new HttpGet(url); CloseableHttpResponse response = client.execute(request); try { return EntityUtils.toString(response.getEntity()); } finally { response.close(); } } public void close() throws IOException { client.close(); } } public class Example { public static void main(String[] args) throws IOException { System.out.println("Performing request(s)"); Client client = new Client(null); try { System.out.println(client.request("https://ip.decodo.com/ip")); } finally { client.close(); } } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |