asynchttpclient

CertificateException with async-http-client for https

你离开我真会死。 提交于 2019-12-08 05:00:37
问题 I started having problems accessing a https://ws.plimus.com/ with async-http-client a few days ago. I get a "General SSLEngine problem" messages, and in the stack trace I can see it is caused by java.security.cert.CertificateException: Certificates does not conform to algorithm constraints This SO question describes basically the same thing. Commenting out the line in java.security makes the error go away, but I assume there is good reason for MD2 to be disabled. Using Raman's answer for

using Apache's AsyncHttpClient in a storm bolt

情到浓时终转凉″ 提交于 2019-12-06 15:04:26
问题 I have a bolt that is making an API call (HTTP Get) for every tuple. to avoid the need to wait for the response, I was looking to use the apache HttpAsyncClient. after instantiating the client in the bolt's prepare method, the execute method constructs the URL from the tuple and calls sendAsyncGetRequest(url): private void sendAsyncGetRequest(String url){ httpclient.execute(new HttpGet(url), new FutureCallback<HttpResponse>() { @Override public void completed(HttpResponse response) { LOG.info

Multiple AsyncHttpClient get requests to populate one activity

我的梦境 提交于 2019-12-06 05:35:34
问题 I have a "GameActivity" and in order to populate the layout I have to make multiple calls to a remote API and wondering the best way to accomplish this using the AsyncHttpClient package http://loopj.com/android-async-http/. My current set-up for a single API call: public class MainActivity extends Activity implements AdapterView.OnItemClickListener, SwipeRefreshLayout.OnRefreshListener{ ListView mainListView; JSONMainAdapter mJSONAdapter; SwipeRefreshLayout swipeLayout; @Override protected

android上传图片到服务器(使用base64字节流的形式通过 AsyncHttpClient框架

筅森魡賤 提交于 2019-12-06 04:16:15
前端 andoid activity用到的函数 AsyncHttpClient 是一个框架提供的库 可以异步传输,使用时需下载android-async-http-1.4.4.jar包导入到项目中 [java] view plain copy public static void reg(final Context cont,Bitmap photodata,String regData) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); //将bitmap一字节流输出 Bitmap.CompressFormat.PNG 压缩格式,100:压缩率,baos:字节流 photodata.compress(Bitmap.CompressFormat.PNG, 100, baos); baos.close(); byte[] buffer = baos.toByteArray(); System.out.println("图片的大小:"+buffer.length); //将图片的字节流数据加密成base64字符输出 String photo = Base64.encodeToString(buffer, 0, buffer.length,Base64.DEFAULT); //photo

android-async-http上传文件

♀尐吖头ヾ 提交于 2019-12-06 04:15:41
1. AsyncHttpClient, RequestParams ,AsyncHttpResponseHandler三个类使用方法 (1)AsyncHttpClient public class AsyncHttpClient extends java.lang.Object 该类通常用在android应用程序中创建异步GET, POST, PUT和DELETE HTTP请求,请求参数通过RequestParams实例创建,响应通过重写匿名内部类 ResponseHandlerInterface的方法处理。 例子: AsyncHttpClient client = new AsyncHttpClient(); client.get("http://www.baidu.com", new ResponseHandlerInterface() { @Override public void onSuccess(String response) { System.out.println(response); } }); (2)RequestParams public class RequestParams extends java.lang.Object 用于创建AsyncHttpClient实例中的请求参数(包括字符串或者文件)的集合 例子: RequestParams params

async-http-client开源库学习笔记(一)

纵饮孤独 提交于 2019-12-06 02:15:40
0. 文前闲话 作为一个Android开发的大龄初学者,面对扑面而来的各种姿势的Android的开源组件,让人倍感窒息,难以应对。无奈为了养家糊口,虽然已近不惑,人老珠黄,也只能废寝忘食,逐个体位细细揣摩研究,不断以身实践,争取早日小成。 话说那是一个阳光明媚的下午,我坐在街口转角处优雅的网络会所里,品着一杯上好的Coca-Cola,研读着oschina客户端源码,身旁不时传来:“一起上搞死他,他没蓝了...!”。 从火蚁(oschina客户端的开发者之一,向他们致敬)那里知道了async-http-client开源库,为了千千万万个没过英语四级的程序猿GG,就在这里翻译个作者写的"用户说明书"先... 1. async-http-client开源库简介 async-http-client库是一个基于回调函数的Http异步通信客户端Android组件,是在Apache的HttpClient库的基础上开发构建而成的。这里的异步,是指它所有的网络请求都是在app的UI线程之外的独立工作线程中执行。而开发者通过利用Android的消息处理机制,把我们所需要编写的回调函数放在这个回调函数的创建线程中执行(一般就是UI线程),所以使用起来非常方便,有了它,妈妈再也不用担心我被多线程同步搞死了。除了能应用在开发普通App上,还可以用来开发Service或后台线程, async-http

android----AsyncHttpClient的get,post和图片上传

匆匆过客 提交于 2019-12-05 08:20:55
async-http-client库是一个基于回调函数的Http异步通信客户端Android组件,是在Apache的HttpClient库的基础上开发构建而成的。 Eclipse使用:导入 android-async-http-1.4.4.jar 包, 点击下载 AndroidStudio: gradle中引入 compile 'com.loopj.android:android-async-http:1.4.8' 功能特色 利用版4.3.6上游HttpClient代替Android提供defaulthttpclient 兼容AndroidAPI 23高 做异步HTTP请求处理的响应匿名回调 HTTP请求发生UI线程之外 请求使用线程池限制并发资源使用情况 get /后参数生成器( RequestParams ) 多文件上传没有额外的第三方库 JSON上传流没有额外的图书馆 处理循环和相对重定向 小的开销给你的应用程序只90kb一切 自动智能请求重试次数质量不一的移动连接优化 自动gzip响应解码速度超快的请求支持 二进制协议通信 binaryhttpresponsehandler 内置的响应分析JSON与 jsonhttpresponsehandler 节能反应直接进入文件 fileasynchttpresponsehandler 大的持久性Cookie

using Apache's AsyncHttpClient in a storm bolt

与世无争的帅哥 提交于 2019-12-04 22:17:29
I have a bolt that is making an API call (HTTP Get) for every tuple. to avoid the need to wait for the response, I was looking to use the apache HttpAsyncClient. after instantiating the client in the bolt's prepare method, the execute method constructs the URL from the tuple and calls sendAsyncGetRequest(url): private void sendAsyncGetRequest(String url){ httpclient.execute(new HttpGet(url), new FutureCallback<HttpResponse>() { @Override public void completed(HttpResponse response) { LOG.info("Response Code : " + response.getStatusLine()); LOG.debug(response.toString()); } @Override public

HTTP requests with HttpClient too slow?

半世苍凉 提交于 2019-12-04 11:21:29
i'm trying to coding an android app that send some post values to a php file hosted at a dedicate server and store the array resoult the code is this HttpPost httppost; DefaultHttpClient httpclient; httppost = new HttpPost("http://IP/script.php"); HttpParams param = new BasicHttpParams(); param.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); // httppost.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false); HttpProtocolParams.setContentCharset(param, "UTF-8"); httpclient = new DefaultHttpClient(param); ResponseHandler <String> res=new

Multiple AsyncHttpClient get requests to populate one activity

余生颓废 提交于 2019-12-04 09:51:05
I have a "GameActivity" and in order to populate the layout I have to make multiple calls to a remote API and wondering the best way to accomplish this using the AsyncHttpClient package http://loopj.com/android-async-http/ . My current set-up for a single API call: public class MainActivity extends Activity implements AdapterView.OnItemClickListener, SwipeRefreshLayout.OnRefreshListener{ ListView mainListView; JSONMainAdapter mJSONAdapter; SwipeRefreshLayout swipeLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout