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

Cookie Support #41

Closed
shism2 opened this issue Nov 10, 2013 · 9 comments
Closed

Cookie Support #41

shism2 opened this issue Nov 10, 2013 · 9 comments
Labels

Comments

@shism2
Copy link

shism2 commented Nov 10, 2013

I haven't really used Glide yet. How do I set headers and use cookies?

@sjudd
Copy link
Collaborator

sjudd commented Nov 10, 2013

By default Glide uses Volley for its network operations. I don't have any specific experience setting headers and cookies, but it's definitely possible to setup Volley however you wish and pass in your own request queue or your own Request subclasses. You can also implement a relatively simple interface and use whatever networking stack you wish: http://bumptech.github.io/glide/docs/com/bumptech/glide/loader/stream/StreamLoader.html. For an example using volley, see https://github.com/bumptech/glide/blob/master/library/src/com/bumptech/glide/volley/VolleyStreamLoader.java.

Once you've defined that interface, you then need just one call to the Glide singleton to replace our default network stack with your own. If you're interested I can also give you some documentation or examples on how that works.

@shism2
Copy link
Author

shism2 commented Nov 10, 2013

Can you please provide me with documentation and examples?

@sjudd
Copy link
Collaborator

sjudd commented Nov 10, 2013

For replacing the default network stack?

@shism2
Copy link
Author

shism2 commented Nov 10, 2013

Well, could you show me an example of what I would have to do to modify the headers or cookies?

@sjudd
Copy link
Collaborator

sjudd commented Nov 10, 2013

As I mentioned before, I've never done it myself. However, it looks like all you need to do is override getHeaders() in the volley request to set whatever you would like. You could start with essentially a copy/paste of VolleyStreamLoader I linked above and then override getHeaders() in the Request inner class.

@shism2
Copy link
Author

shism2 commented Nov 10, 2013

Ok, thank you.

@shism2 shism2 closed this as completed Nov 10, 2013
@bpappin
Copy link

bpappin commented Oct 17, 2014

Both of those links are returning 404.

@bpappin
Copy link

bpappin commented Oct 17, 2014

Yeah, just discovered I can't add volley to this project as an android library.

The simplest way I that I can think to do this, is something like the setDefaultOptions except it exposed the request prior to executing the HTTP call.
That would allow the user to modify the request and set headers or cookies as needed.

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

No branches or pull requests

4 participants