Thursday, April 28, 2011

Java and proxy's

So i am testing a couple of API, and after sorting a couple of them, i am undecided between zemanta and opencalais.

A can use both perfectly at home, but at the company behind the proxy, i can put them working, even when running the same examples.

I am running this example http://philippeadjiman.com/blog/2009/09/16/open-calais-from-java-with-eclipse-extract-entities-facts-and-events-in-4-minutes/ and this http://developer.zemanta.com/wiki both java versions

How can i setup the proxy so it works?

blueomega

From stackoverflow
  • For Zemanta, this is what you need to do before you make the call,

    System.setProperty("https.proxyHost", proxyHost);
    System.setProperty("https.proxyPort", proxyPort);
    

    Not familiar with Open Calais, you may have to do something different for it to work.

    blueomega : odd i tried in calais something like URL url = new URL(u); HttpURLConnection con = (HttpURLConnection)url.openConnection(); System.setProperty("http.proxyHost", "proxy"); System.setProperty("http.proxyPort", "port"); con.setRequestProperty("Proxy-Authorization", "Basic " + base64Encode(new String("user:pass"))); but thx, going to check tomorrow.

0 comments:

Post a Comment