1

私はいくつかのアンドロイドアプリを作っています。ログアウトするには、http 削除要求をサーバーに送信する必要があります。loopj ライブラリを使用しました。

というわけで、こんなの作ってます。

ConnectionInfo.java

public ConnectionInfo(Context ctx) {    
    this.context = ctx;    
}

public void sign_out(String Url, AsyncHttpResponseHandler handler) {
    CommonClient.setCookieStore(myApplication.getCookieStore());
    CommonClient.delete(context, Url.toString(), handler);
}

public void sign_in(HashMap<String, String> params, JsonHttpResponseHandler handler) {
    Uri.Builder requestUri = new Uri.Builder();
    requestUri.scheme(SCHEME);
    requestUri.authority(HOST);
    requestUri.path(sign_in);
    CommonClient.post(context, requestUri.toString(), params, handler);
}

CommonClient.java

public class CommonClient {
    private static final AsyncHttpClient AsyncClient = new AsyncHttpClient();

public static void post(Context mContext, String actionserver,
    RequestParams params, JsonHttpResponseHandler responseHandler) {
    AsyncClient.post(mContext, actionserver, params, responseHandler);
}

その後

一部のアクティビティ クラスで、sign_in メソッドを呼び出します。

connectionInfo.sign_in(params, UserLoginJsonHandler);

いくつかの作業が完了し、他の Activity クラスが sign_out メソッドを呼び出します。このような。

connectionInfo.sign_out(url, asyncHttpResponseHandler);

しかし、私は別のIDでログインしています。ユーザーの前にログインを保持します。

私は、ログインとログアウトのセッションやクッキーが違うと思いますか?

loopj を使用してログアウトするにはどうすればよいですか? どうすれば修正できますか?

私を助けてください。

4

1 に答える 1

0

にはdeleteメソッドAsyncHttpClientもあり、オーバーロードされているため、必要に応じて選択できます。使用例は次のとおりです。

AsyncHttpClient client = new AsyncHttpClient();
AsyncClient.delete(context, url, responseHandler);
于 2014-02-16T18:06:06.010 に答える