Expand my Community achievements bar.

SOLVED

AFCS.java doesn't handle the http redirect request

Avatar

Level 2

Hi AFCS team,

     I just tried out the java script for external authentication. By default, when calling new AFCS.AccountManager(accountURL);, I'll get an error like the following:

"GET http://connectnow.acrobat.com/myaccount?mode=xml&accountonly=true&; failed with status 302";

     Actually this url will be redirected to "https://na2.connectnow.acrobat.com/myaccount?mode=xml&accountonly=true&" for me.

     However,  the script handles the http response only when status=200, or it consider the status as error.

     So I added following code to http_get()/http_post(), everything goes well so far.

            if (responseCode == 200) {

               ......

                return connection.getInputStream();
            }
            // handle the redirect status
            else if (responseCode == 302) {
                return http_get(connection.getHeaderField("Location"), headers);
            }

            else {

               throw new Error();

            }

     Is it something need to be fixed in next release?

Thanks!

Jinni

1 Accepted Solution

Avatar

Correct answer by
Employee

This has been fixed for the next version of the SDK. Thanks!

View solution in original post

4 Replies

Avatar

Employee

So, the code was there a couple of releases ago, and then I took it out because I noticed that the lower level API were already processing redirections (but at this point I don't know on which case)

I'll do some more testing and if needed add the code back. Thanks for pointing it out!

Avatar

Level 1

I got this error too and spent about an hour trying to figure it out before checking the forums.  Jinni's code fixed it. Thanks!  It would be really helpful if that code was back in the release.

Avatar

Correct answer by
Employee

This has been fixed for the next version of the SDK. Thanks!

Avatar

Level 2

Great! I'm very glad to see the it's been fixed~.

Thanks!

Jinni