Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ghostganz/230960 to your computer and use it in GitHub Desktop.
Save ghostganz/230960 to your computer and use it in GitHub Desktop.
Index: facebook-java-api/src/main/java/com/google/code/facebookapi/ExtensibleClient.java
===================================================================
--- facebook-java-api/src/main/java/com/google/code/facebookapi/ExtensibleClient.java (revision 854)
+++ facebook-java-api/src/main/java/com/google/code/facebookapi/ExtensibleClient.java (arbetskopia)
@@ -11,9 +11,7 @@
import java.io.OutputStream;
import java.io.Reader;
import java.io.StringWriter;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -71,6 +69,7 @@
protected final String _apiKey;
protected final String _secret;
protected boolean _isDesktop;
+ protected Proxy _proxy;
protected String cacheSessionKey;
protected Long cacheUserId;
@@ -115,9 +114,15 @@
this.queries = new ArrayList<BatchQuery>();
}
+ public Proxy getProxy() {
+ return _proxy;
+ }
+ public void setProxy(Proxy proxy) {
+ this._proxy = proxy;
+ }
- public URL getServerUrl() {
+ public URL getServerUrl() {
return _serverUrl;
}
@@ -566,7 +571,11 @@
OutputStream out = null;
InputStream in = null;
try {
- conn = (HttpURLConnection) serverUrl.openConnection();
+ if (_proxy != null) {
+ conn = (HttpURLConnection) serverUrl.openConnection(_proxy);
+ } else {
+ conn = (HttpURLConnection) serverUrl.openConnection();
+ }
if ( _connectTimeout != -1 ) {
conn.setConnectTimeout( _connectTimeout );
}
Index: facebook-java-api/src/main/java/com/google/code/facebookapi/IFacebookRestClient.java
===================================================================
--- facebook-java-api/src/main/java/com/google/code/facebookapi/IFacebookRestClient.java (revision 854)
+++ facebook-java-api/src/main/java/com/google/code/facebookapi/IFacebookRestClient.java (arbetskopia)
@@ -4,6 +4,7 @@
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.net.Proxy;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@@ -69,7 +70,10 @@
public String getResponseFormat();
+ public Proxy getProxy();
+ public void setProxy(Proxy proxy);
+
public String getApiKey();
public String getSecret();
Index: facebook-java-api/src/main/java/com/google/code/facebookapi/BaseAdapter.java
===================================================================
--- facebook-java-api/src/main/java/com/google/code/facebookapi/BaseAdapter.java (revision 854)
+++ facebook-java-api/src/main/java/com/google/code/facebookapi/BaseAdapter.java (arbetskopia)
@@ -1,6 +1,7 @@
package com.google.code.facebookapi;
import java.net.URL;
+import java.net.Proxy;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@@ -184,6 +185,14 @@
getClient().setConnectTimeout( connectTimeout );
}
+ public Proxy getProxy() {
+ return getClient().getProxy();
+ }
+
+ public void setProxy(Proxy proxy) {
+ getClient().setProxy(proxy);
+ }
+
public int getReadTimeout() {
return getClient().getReadTimeout();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment