2

I am using Facebook4J to to retrieve facebook feeds. This works perfectly when i am not using proxy but when i swtich on proxy, i expect the call to go through proxy.

but the call is always going through direct internet connection.

THE CALLS ARE NOT GOING THROUGH PROXY CONFIGURRATION, I HAVE TRIED THIS WITH RESTFB TOO AND I OBSERVE THE SAME BEHAVIOUR

ANY IDEAS? has anyone noticed this behaviour?

CHEERS & Thanks

i am configuring proxy as below:

FacebookFactory factory = null;
        if ("true".equalsIgnoreCase(PROXY_ENABLED)) {
            factory = new FacebookFactory(buildConfiguration(appId, appIdSecret, true));
        }  else {
             factory = new FacebookFactory(buildConfiguration(appId, appIdSecret, false));
        }



private Configuration buildConfiguration(String appId, String appIdSecret, boolean proxyEnabled) {
        ConfigurationBuilder builder = new ConfigurationBuilder();      
        builder.setDebugEnabled(true);
        builder.setOAuthAppId(appId);
        builder.setOAuthAppSecret(appIdSecret);
        builder.setUseSSL(true);
        builder.setJSONStoreEnabled(true);

        if(proxyEnabled) {          
            logger.info("Creating Facebook Factory with proxy Facebook4J ...");
            builder.setHttpProxyHost(PROXY_HOST);
            builder.setHttpProxyPort(Integer.parseInt(PROXY_PORT));
            builder.setHttpProxyUser(PROXY_USER);
            builder.setHttpProxyPassword(PROXY_PASS);           
        }           
        return builder.build();
    }
jack
  • 65
  • 6

1 Answers1

0

You code is absolutely perfect to make it run under the proxy environment.
Make sure that you are setting PROXY_ENABLED = TRUE while running with proxy.

For me, it works well.

Nishu Tayal
  • 20,106
  • 8
  • 49
  • 101