You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Hi Everyone, I would like to understand a little bit more about this annotations. My specific case is related to requires and sets Cookies annotations. I´ve created my Interface as below:
Basically my problem comes when I´m trying to call the login Mehod, it supposed that once that it was called, this mothod must to set those cookies "_aecp_dev" and "_aecp_dev_user". But instead, the cookie with the key "_aecp_dev" is getting set with the value of the key "aecp_dev_user", due to in the MyAccount generated class exist this function inside logIn mehod:
List<String> allCookies = response.getHeaders().get("Set-Cookie");
if (allCookies!= null) {
for (StringrawCookie: allCookies) {
for (StringthisCookieName: requestedCookies) {
/***In this line is were the problem appears cuz both keys start with the same name***/if (rawCookie.startsWith(thisCookieName)) {
intvalueEnd = rawCookie.indexOf(';');
if (valueEnd == -1) {
valueEnd = rawCookie.length();
}
availableCookies.put(thisCookieName, rawCookie.substring((rawCookie.indexOf("=")+ 1), valueEnd));
break;
}
}
}
the problem was that both Keys starts with the same name, and the return of those cookies from server, was ovewriting the values for one of those cookies and null for the other, so to avoid that I put in the first position, the cookie with longest String length and in the second position, a cookie with shorter key as Bellow:
/*Before I change*/@SetsCookie({"_aecp_dev","_aecp_dev_user"})
GenericResponselogIn(@BodyMultiValueMapformParams);
/*After I change*/@SetsCookie({"_aecp_dev_user","_aecp_dev"})
GenericResponselogIn(@BodyMultiValueMapformParams);
2.) Second Approach:
In the auto gerated Class" myInterface_" once the part for setsallcookies it´s created you must to add another condition to build the cookie:
if (rawCookie.startsWith(thisCookieName) && rawCookie.substring(rawCookie.indexOf(thisCookieName+ 1)).equals("="))
Hi Everyone, I would like to understand a little bit more about this annotations. My specific case is related to requires and sets Cookies annotations. I´ve created my Interface as below:
Basically my problem comes when I´m trying to call the login Mehod, it supposed that once that it was called, this mothod must to set those cookies "_aecp_dev" and "_aecp_dev_user". But instead, the cookie with the key "_aecp_dev" is getting set with the value of the key "aecp_dev_user", due to in the MyAccount generated class exist this function inside logIn mehod:
Any ideas? what I´m doing worng?
Thanks