okHttp方式访问方式
import okhttp3.*;
import okhttp3.Response;
import java.io.IOException;
/**
* Created by 01457141 on 2017/8/8.
*/
public class HttpUtils {
private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
private static OkHttpClient client = new OkHttpClient();
public static Response post(String url, String json) throws IOException {
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
Response response = client.newCall(request).execute();
return response;
}
public static Response get(String url) throws IOException {
Request request = new Request.Builder()
.url(url)
.build();
Response