com.hadoopz.cloud.JCloud.SDK.utils.SDKKiller Maven / Gradle / Ivy
The newest version!
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.hadoopz.cloud.JCloud.SDK.utils;
import com.mycomm.IProtocol.log.UniversalLogHolder;
import com.mycomm.YesHttp.core.HttpMethod;
import com.mycomm.YesHttp.core.Request;
import com.mycomm.YesHttp.core.Response;
import com.mycomm.YesHttp.core.StringRequest;
import com.mycomm.YesHttp.core.TextBaseResponseListener;
import com.mycomm.YesHttp.core.YesHttpEngine;
import com.mycomm.YesHttp.core.YesHttpError;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
/**
*
* @author jw362j
*/
public class SDKKiller {
public void dismissSession(final String jcloudToken){
String url = EndpointBuilder.getFullUrlForLogout();
//final JSONObject ps = new JSONObject();
Request request = new StringRequest(HttpMethod.POST, url, new TextBaseResponseListener() {
@Override
public void responseMe(String msg) {
try {
YesLog.yeslog.d("the requestjSON TextBaseResponseListener.responseMe:" + msg);
JSONObject datas = new JSONObject(msg);
} catch (JSONException ex) {
UniversalLogHolder.d(getClass().getSimpleName(), ex.getMessage());
}
}
}, new Response.ErrorListener() {
public void onErrorResponse(YesHttpError error) {
YesLog.yeslog.e("the requestjSON ErrorListener.onErrorResponse:" + error.getMessage());
}
}, YesLog.yeslog, Request.Protocol.HTTP) {
@Override
public void getHeaders(Map headers) {
headers.put("Authorization", jcloudToken);
}
@Override
public void getParams(Map ps) {
ps.put("jcloudToken", jcloudToken); //To change body of generated methods, choose Tools | Templates.
}
};
YesHttpEngine.getYesHttpEngine().send(request);
}
}