File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/main/java/org/maxgamer/quickshop/util Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 2121
2222import com .google .common .cache .CacheBuilder ;
2323import lombok .val ;
24- import okhttp3 .*;
24+ import okhttp3 .Cache ;
25+ import okhttp3 .OkHttpClient ;
26+ import okhttp3 .Request ;
27+ import okhttp3 .RequestBody ;
28+ import okhttp3 .Response ;
2529import org .jetbrains .annotations .NotNull ;
2630import org .jetbrains .annotations .Nullable ;
2731
@@ -36,6 +40,8 @@ public class HttpUtil {
3640 private static final OkHttpClient client = new OkHttpClient .Builder ()
3741 .cache (new Cache (getCacheFolder (), 50L * 1024L * 1024L )).build ();
3842
43+
44+ @ Deprecated
3945 public static HttpUtil create () {
4046 return new HttpUtil ();
4147 }
@@ -83,16 +89,24 @@ public static String createGet(@NotNull String url, boolean flushCache) {
8389 return null ;
8490 }
8591 }
92+
8693 @ NotNull
8794 public static Response makePost (@ NotNull String url , @ NotNull RequestBody body ) throws IOException {
8895 return client .newCall (new Request .Builder ().post (body ).url (url ).build ()).execute ();
8996 }
97+
9098 @ NotNull
9199 private static File getCacheFolder () {
92100 File file = new File (Util .getCacheFolder (), "okhttp_tmp" );
93101 file .mkdirs ();
94102 return file ;
95103 }
104+
105+ public static OkHttpClient getClientInstance () {
106+ return client ;
107+ }
108+
109+ @ Deprecated
96110 @ NotNull
97111 public OkHttpClient getClient () {
98112 return client ;
You can’t perform that action at this time.
0 commit comments