Java HttpClient';s GetMethod不执行';不使用重定向
因此,我试图调用一个GET请求来链接Java HttpClient';s GetMethod不执行';不使用重定向,java,apache-commons-httpclient,getmethod,Java,Apache Commons Httpclient,Getmethod,因此,我试图调用一个GET请求来链接 https://captivate.taps.com/auth/authorize?client_id=7b3fe4ba-3c3d-4fbf&redirect_uri=http://localhost:4502/ats/GetCode.html 此链接将授权客户端id并重定向到所提供的url,并在url后附加参数“code” 调用GET请求的代码为- HttpClient client = new HttpClient(); Str
https://captivate.taps.com/auth/authorize?client_id=7b3fe4ba-3c3d-4fbf&redirect_uri=http://localhost:4502/ats/GetCode.html
此链接将授权客户端id并重定向到所提供的url,并在url后附加参数“code”
调用GET请求的代码为-
HttpClient client = new HttpClient();
String url = "https://captivate.taps.com/auth/authorize?client_id=7b3fe4ba-3c3d-4fbf&redirect_uri=http://localhost:4502/ats/GetCode.html";
GetMethod getMethod = new GetMethod(url);
getMethod.setFollowRedirects(true);
int getStatus = client.executeMethod(getMethod);
重定向的url-http://localhost:4502/ats/GetCode.html
有代码吗-
String authCode = request.getParameter("code");
GetAccessToken.code = authCode; // GetAccessToken is a class with a static String "code".
问题是,当我使用浏览器启动链接时,会调用GetCode.html并分配授权代码,但当我使用从未调用GetCode.html的代码执行相同操作时
更新:这里我只想捕获重新定价的url,以便从中获取授权代码如何在
captivate.taps.com
上执行重定向?HTTP 302,thorugh JavaScript,HTML meta,…@Jiri-其HTTP 302