2010-11-05 92 views
0

我使用google-oauth-java一两件事,我的生活真的变得复杂的是,当我尝试使用OAuthClient.invoke()我经常得到OAuthProblemException抛出由于请求返回正因为如此代码302,而不是200,我发现自己重写invoke代码,并使用OAuthClient.access()代替。我想知道我是否缺少某种类型的followRedirect设置?文档不存在,例子也没有帮助,有人可以帮我吗?google-oauth-java如何处理重定向?

下面是从OAuthClient片段阐述

public OAuthMessage invoke(OAuthMessage request, ParameterStyle style) 
     throws IOException, OAuthException { 
    OAuthResponseMessage response = access(request, style); 
    if ((response.getHttpResponse().getStatusCode()/100) != 2) { 
     OAuthProblemException problem = response.toOAuthProblemException(); 
     try { 
      problem.setParameter(OAuthProblemException.SIGNATURE_BASE_STRING, 
           OAuthSignatureMethod.getBaseString(request)); 
     } catch (Exception ignored) { 
     } 
     throw problem; 
    } 
    return response; 
} 

回答

0

因为我处理这个使用OAuthClient.access(),没有人挺身而出,我要接受我自己的解决方案