<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                封裝get、post請求: ~~~ public class HttpKit { private static final String BASE_URL = CanYouUrl.API_DOMAIN; private static AsyncHttpClient client = new AsyncHttpClient(); private static final PersistentCookieStore cookieStore = new PersistentCookieStore( App.mContext); public static void cancelAll() { client.cancelAllRequests(true); } public static void directGet(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) { client.get(url, params, responseHandler); } /** * get請求 * * @param url 路徑 * @param params 參數 * @param responseHandler 回調 */ public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) { client.addHeader("Content-Type", "application/json"); client.get(getAbsoluteUrl(url), params, responseHandler); } /** * post請求 * * @param url 路徑 * @param params 參數 * @param responseHandler 回調 */ public static void post(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) { client.addHeader("Content-Type", "application/json"); client.put(getAbsoluteUrl(url), params, responseHandler); } /** * post 請求 * * @param context 上下文 * @param url 路徑 * @param json 實體json * @param responseHandler 回調 */ public static void post(Context context, String url, String json, AsyncHttpResponseHandler responseHandler) { client.addHeader("Content-Type", "application/json"); try { ByteArrayEntity entity = new ByteArrayEntity(json.getBytes("UTF-8")); client.post(context, getAbsoluteUrl(url), entity, "application/json", responseHandler); } catch (Exception e) { CanYouLog.e("網絡請求錯誤:" + e.toString()); } } /** * api地址 * * @param relativeUrl * @return */ private static String getAbsoluteUrl(String relativeUrl) { client.setCookieStore(cookieStore); return BASE_URL + relativeUrl; } public static void clearCookie() { cookieStore.clear(); } } ~~~ 使用實例: ~~~ /** * 用戶登錄 * * @param username 用戶名 * @param password 密碼 * @param responseHandler 回調 */ public static void login(String username, String password, AsyncHttpResponseHandler responseHandler) { RequestParams params = new RequestParams(); params.put("username", username); params.put("password", password); HttpKit.get(CanYouUrl.login, params, responseHandler); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看