Android Open Source - Projectile Ok Http Stack






From Project

Back to project page Projectile.

License

The source code is released under:

Apache License

If you think the Android project Projectile listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.nicktate.projectile;
/* w ww . j av  a  2 s .  co m*/
import com.android.volley.toolbox.HurlStack;
import com.squareup.okhttp.OkHttpClient;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * <p>
 * An {@link com.android.volley.toolbox.HttpStack HttpStack} implementation which
 * uses OkHttp as its transport.
 * </p>
 *
 * @see <a href="https://gist.github.com/JakeWharton/5616899">https://gist.github.com/JakeWharton/5616899</a>
 */
public class OkHttpStack extends HurlStack {
    private final OkHttpClient client;

    public OkHttpStack() {
        this(new OkHttpClient());
    }

    public OkHttpStack(OkHttpClient client) {
        if (client == null) {
            throw new NullPointerException("Client must not be null.");
        }
        this.client = client;
    }

    @Override protected HttpURLConnection createConnection(URL url) throws IOException {
        return client.open(url);
    }
}




Java Source Code List

com.nicktate.Sample.java
org.nicktate.projectile.JsonElementListener.java
org.nicktate.projectile.Method.java
org.nicktate.projectile.NetworkResponseListener.java
org.nicktate.projectile.OkHttpStack.java
org.nicktate.projectile.Priority.java
org.nicktate.projectile.ProjectileRequest.java
org.nicktate.projectile.Projectile.java
org.nicktate.projectile.ResponseListener.java
org.nicktate.projectile.StringListener.java