Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java HttpClient';s GetMethod不执行';不使用重定向_Java_Apache Commons Httpclient_Getmethod - Fatal编程技术网

Java HttpClient';s GetMethod不执行';不使用重定向

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

因此,我试图调用一个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();
    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