- 授权协议: GPL
- 开发语言: Java
- 操作系统: 跨平台
- 软件首页: https://github.com/panxw/android-async-http-cached
软件介绍
android-async-http (android-async-http-cached)是基于 Android Asynchronous HTTP Library (https://github.com/loopj/android-async-http) 实现。
1.增加响应数据本地缓存功能。
2.便于JSON-RPC,XML-RPC方式调用。
用法:
public class TestActivity extends Activity {
private static final int REQUEST_GET_ID = 0;
private static final int REQUEST_POST_ID = 1;
private static final int REQUEST_POST_JSON_ID = 2;
private static final int REQUEST_POST_XML_ID = 3;
private RequestManager mRequestManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.mRequestManager = RequestManager
.getInstance(getApplicationContext());
get();
postParams();
postJSONObject();
postXML();
}
/**
* get by url
*/
private void get() {
this.mRequestManager
.get("http://app.shafa.com/api/push/download/52a093cf3bf55d361e000477?response-content-type=application%2fvnd.android.package-archive",
null, requestListener, true, REQUEST_GET_ID);
}
/**
* post by RequestParams
*/
private void postParams() {
final RequestParams params = new RequestParams();
params.put("key1", "value1");
params.put("key2", "value2");
this.mRequestManager.post("http://server.winfirm.net/memoServer",
params, requestListener, REQUEST_POST_ID);
}
/**
* post by JSONObject
*/
private void postJSONObject() {
final JSONObject json = new JSONObject();
try {
json.put("key1", "value1");
json.put("key2", "value2");
} catch (JSONException e) {
e.printStackTrace();
}
this.mRequestManager.post("http://server.winfirm.net/memoServer", json,
requestListener, REQUEST_POST_JSON_ID);
}
/**
* post by xml
*/
private void postXML() {
final String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><key1>value1</key1><key2>value2</key2>";
this.mRequestManager.post("http://server.winfirm.net/memoServer", xml,
requestListener, REQUEST_POST_XML_ID);
}
/**
* request listener
*/
private RequestListener requestListener = new RequestListener() {
@Override
public void onStart() {
}
@Override
public void onCompleted(int statusCode, byte[] data,
String description, int actionId) {
try {
System.out.println(new String(data, "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
if (REQUEST_GET_ID == actionId) {
if (RequestListener.OK == statusCode) {
// sucess
} else {
// handler error case
}
} else if (REQUEST_POST_ID == actionId) {
} else if (REQUEST_POST_JSON_ID == actionId) {
} else if (REQUEST_POST_XML_ID == actionId) {
}
}
@Override
public void onProgress(int bytesWritten, int totalSize, int actionId) {
System.out.println(bytesWritten + "/" + totalSize);
}
};
}
创新者的窘境(全新修订版)
克莱顿•克里斯坦森 / 胡建桥 / 中信出版社 / 2014-1-1 / 48.00元
全球商业领域中,许多企业曾叱咤风云,但面对市场变化及新技术的挑战,最终惨遭淘汰。究其原因,竟然是因为它们精于管理,信奉客户至上等传统商业观念。这就是所有企业如今都正面临的“创新者的窘境”。 在《创新者的窘境》中,管理大师克里斯坦森指出,一些看似很完美的商业动作——对主流客户所需、赢利能力最强的产品进行精准投资和技术研发——最终却很可能毁掉一家优秀的企业。他分析了计算机、汽车、钢铁等多个行业的......一起来看看 《创新者的窘境(全新修订版)》 这本书的介绍吧!
