public static void getToken(String cookie, HttpResponseHandler httpResponseHandler) { System.out.println("cookie:" + cookie); Map<String, String> headers = new HashMap<>(1); headers.put("cookie", cookie); HttpClientUtil.getHttpClientUtil() .sendGetRequest(USER_GET_TOKEN, headers, null, httpResponseHandler); }
/** * 用户登录 * * @param userName * @param password * @param httpResponseHandler */ public static void login( String userName, String password, HttpResponseHandler httpResponseHandler) { Map<String, String> params = new HashMap<String, String>(2); params.put("email", userName); params.put("password", password); HttpClientUtil.getHttpClientUtil().sendPostRequest(USER_LOGIN_URL, params, httpResponseHandler); }
public static void register( String userName, String password, HttpResponseHandler httpResponseHandler) { Map<String, String> params = new HashMap<String, String>(2); params.put("email", userName); params.put("password", password); params.put("mobile", "123"); params.put("username", "xxx"); HttpClientUtil.getHttpClientUtil() .sendPostRequest(USER_REGISTER_URL, params, httpResponseHandler); }
public static void getLocalToken(String userName, HttpResponseHandler httpResponseHandler) { String url = GET_TOKEN1 + userName + "/getToken"; HttpClientUtil.getHttpClientUtil().sendGetRequest(url, httpResponseHandler); }