Back to project page jive-android-core-sdk-example.
The source code is released under:
Apache License
If you think the Android project jive-android-core-sdk-example listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.jivesoftware.example.utils; //from ww w . j a v a 2 s . c om import android.content.Context; import android.net.Uri; import com.google.common.net.HttpHeaders; import com.squareup.picasso.UrlConnectionDownloader; import org.apache.http.message.BasicNameValuePair; import java.io.IOException; import java.net.HttpURLConnection; /** * Created by mark.schisler on 10/16/14. */ public class AuthenticatedDownloader extends UrlConnectionDownloader { private PersistedKeyValueStore keyValueStore; public AuthenticatedDownloader(Context context, PersistedKeyValueStore keyValueStore) { super(context); this.keyValueStore = keyValueStore; } @Override protected HttpURLConnection openConnection(Uri path) throws IOException { HttpURLConnection connection = super.openConnection(path); BasicNameValuePair header = new BasicNameValuePair(HttpHeaders.AUTHORIZATION, keyValueStore.getJiveToken()); if (header != null) { connection.addRequestProperty(header.getName(), header.getValue()); } return connection; } }