Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interceptors and PersistentCookieJar does not work together #5

Open
kaloglu opened this issue Apr 12, 2016 · 11 comments
Open

interceptors and PersistentCookieJar does not work together #5

kaloglu opened this issue Apr 12, 2016 · 11 comments

Comments

@kaloglu
Copy link

kaloglu commented Apr 12, 2016

when I added interceptor to okclient, persistentcookiejar does not working.
do you know any reason or solution?

@franmontiel
Copy link
Owner

I'm not aware of any interceptor incompatibility, I'm using a few of them in a project right now. Do you have any more information about the problem?

@kaloglu
Copy link
Author

kaloglu commented Apr 12, 2016

This is working fine.

ClearableCookieJar cookieJar = new PersistentCookieJar(new SetCookieCache(), new SharedPrefsCookiePersistor(MyApplication.getInstance().getBaseContext()));

        client = new OkHttpClient.Builder()
                .connectTimeout(95, TimeUnit.SECONDS)
                .readTimeout(95, TimeUnit.SECONDS)
                .writeTimeout(95, TimeUnit.SECONDS)
                .cookieJar(cookieJar)
                .build();

But,

when it changed by that, cookies lost and can't keep persistent.

ClearableCookieJar cookieJar = new PersistentCookieJar(new SetCookieCache(), new SharedPrefsCookiePersistor(TutturApplication.getInstance().getBaseContext()));

        client = new OkHttpClient.Builder()
                .connectTimeout(95, TimeUnit.SECONDS)
                .readTimeout(95, TimeUnit.SECONDS)
                .writeTimeout(95, TimeUnit.SECONDS)
                .cookieJar(cookieJar)
                .addInterceptor( new Interceptor() {
                    @Override
                    public Response intercept(Chain chain) throws IOException {
                        Response response = chain.proceed(chain.request());
                        Log.w("Retrofit@Response", response.body().string());
                        return response;
                    }
                })
                .build();

@RiteshChandnani
Copy link

Any update?

@franmontiel
Copy link
Owner

I have been using the library with multiple interceptors without problems.
It would be useful to have a complete project that reproduces the issue.

@kaloglu
Copy link
Author

kaloglu commented Oct 13, 2016

Could you give me a working example?

13 Eki 2016 8:25 PM tarihinde "Fran Montiel" [email protected]
yazdı:

I have been using the library with multiple interceptors without problems.
It would be useful to have a complete project that reproduces the issue.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#5 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABklAu88CSwDesgYvaGA5MxPxQu1TCktks5qzmmFgaJpZM4IFF_x
.

@franmontiel
Copy link
Owner

@kaloglu right now is not possible, all my examples are in closed-source projects and I don't have much time to separate the network part into an example.

@kaloglu
Copy link
Author

kaloglu commented Oct 13, 2016

When I added interceptor project crashed.
Cookiejar or interceptors removed everythings ok.

13 Eki 2016 8:31 PM tarihinde "Fran Montiel" [email protected]
yazdı:

@kaloglu https://github.com/kaloglu right now is not possible, all my
examples are in closed-source projects and I don't have much time to
separate the network part into an example.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#5 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABklAiHwXzMyX0TimUCaRJPdmnUgcJHfks5qzmsNgaJpZM4IFF_x
.

@franmontiel
Copy link
Owner

@kaloglu if you can create and share a basic project that reproduces the issue I could take a look to see if it is a library problem.

Also, what is the exception that is thrown?

@kaloglu
Copy link
Author

kaloglu commented Oct 13, 2016

Ok thank you

13 Eki 2016 11:57 PM tarihinde "Fran Montiel" [email protected]
yazdı:

@kaloglu https://github.com/kaloglu if you can create and share a basic
project that reproduces the issue I could take a look to see if it is a
library problem.

Also, what is the exception that is thrown?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#5 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABklAsXy4aRFhXIQI1oPneVH8qOdNCCfks5qzpsxgaJpZM4IFF_x
.

@kenilt
Copy link

kenilt commented Nov 2, 2016

I got the same issue. :|

@kaloglu
Copy link
Author

kaloglu commented Nov 2, 2016

Hi, this problem solved on my app.
I dont know why, I changed nothing but try to add again 2 days ago and its
worked.

2 Kas 2016 12:38 tarihinde "Thang Nguyen" [email protected] yazdı:

I got the same issue. :|


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#5 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABklAm_VR1Pi8qu1OrkeP-fXH-5s6TMEks5q6FoXgaJpZM4IFF_x
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants