Announcement Announcement Module
Collapse
No announcement yet.
TwitterTemplate behind a proxy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • TwitterTemplate behind a proxy

    Hi

    I'm receiving java.net.ConnectException connection timed out errors when using TwitterTemplate in Tomcat 6 running behind a proxy.

    I've set http.proxyHost and http.proxyPort as system settings and verified they are correct during runtime.

    As I can't really access the restTemplate, is there anything else I could try to make it use the proxy?

    Thanks in advance

  • #2
    update: still cannot get this to work.

    Using Twitter4Jj as a replacement on same box with same settings works fine.

    Anyone else had any proxy problems here (although it's an assumption really that it's proxy related I guess)??

    Comment


    • #3
      I have the same issue. I'm unable to set the proxy settings for FacebookTemplate. I tried extending and overriding FacebookTemplate, RequestFactory, and other classes that only lead to confusion.

      I thought why the heck am I doing all these just to set the proxy settings. So I deleted all the classes I did because it doesn't feel right.

      Setting the proxy should be a simple configuration or at least easily accessible.

      Comment


      • #4
        As I said in reply to another thread, there is currently no easy way to configure Spring Social to be used behind a proxy. But this should definitely be addressed. Therefore, I've created https://jira.springsource.org/browse/SOCIAL-146 to track this issue and will be working to resolve it.

        Comment


        • #5
          Here is how I passed my &^%&*^%&% NTLM proxy with spring-social milestone 1:

          Code:
          public class FacebookTemplateExt extends FacebookTemplate
          {
              public FacebookTemplateExt(String accessToken, boolean puseProxy, String pproxyUrl, int pproxyPort, String pproxyLogin, String pproxyPwd)
              {
                  super(accessToken);
          
                  if(puseProxy)
                  {
                      HttpClient httpclient = ((CommonsClientHttpRequestFactory) (((RestTemplate) restOperations).getRequestFactory()))
                              .getHttpClient();
              
                      httpclient.getHostConfiguration().setProxy(pproxyUrl, pproxyPort);
              
                      List<String> authPrefs = new ArrayList<String>(2);
                      authPrefs.add(AuthPolicy.DIGEST);
                      authPrefs.add(AuthPolicy.BASIC);
                      // This will exclude the NTLM authentication scheme
                      httpclient.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
                      httpclient.getState().setProxyCredentials(AuthScope.ANY, new UsernamePasswordCredentials(pproxyLogin, pproxyPwd));
                  }
              }
          I will try to adapt to spring-social M3.

          Ludovic

          Comment

          Working...
          X