Search in sources :

Example 11 with AsyncHttpClient

use of com.loopj.android.http.AsyncHttpClient in project android-sex-http by dtboy1995.

the class HTTPUtil method setHttpPort.

public static void setHttpPort(int httpPort) {
    HTTP_PORT = httpPort;
    client = new AsyncHttpClient(true, HTTP_PORT, HTTPS_PORT);
    client.setURLEncodingEnabled(false);
}
Also used : AsyncHttpClient(com.loopj.android.http.AsyncHttpClient)

Example 12 with AsyncHttpClient

use of com.loopj.android.http.AsyncHttpClient in project android-sex-http by dtboy1995.

the class HTTPUtil method setHttpsPort.

public static void setHttpsPort(int httpsPort) {
    HTTPS_PORT = httpsPort;
    client = new AsyncHttpClient(true, HTTP_PORT, HTTPS_PORT);
    client.setURLEncodingEnabled(false);
}
Also used : AsyncHttpClient(com.loopj.android.http.AsyncHttpClient)

Example 13 with AsyncHttpClient

use of com.loopj.android.http.AsyncHttpClient in project xabber-android by redsolution.

the class FileManager method getFileUrlSize.

private static void getFileUrlSize(final MessageItem messageItem) {
    LogManager.i(FileManager.class, "Requesting file size");
    AsyncHttpClient client = new AsyncHttpClient();
    client.head(messageItem.getText(), new AsyncHttpResponseHandler() {

        @Override
        public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
            for (Header header : headers) {
                if (header.getName().equals(HttpHeaders.CONTENT_LENGTH)) {
                    messageItem.setFileSize(Long.parseLong(header.getValue()));
                    MessageManager.getInstance().onChatChanged(messageItem.getChat().getAccount(), messageItem.getChat().getUser(), false);
                    break;
                }
            }
        }

        @Override
        public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
        }
    });
}
Also used : Header(cz.msebera.android.httpclient.Header) AsyncHttpResponseHandler(com.loopj.android.http.AsyncHttpResponseHandler) AsyncHttpClient(com.loopj.android.http.AsyncHttpClient)

Aggregations

AsyncHttpClient (com.loopj.android.http.AsyncHttpClient)13 PersistentCookieStore (com.loopj.android.http.PersistentCookieStore)4 AsyncHttpResponseHandler (com.loopj.android.http.AsyncHttpResponseHandler)3 Header (cz.msebera.android.httpclient.Header)2 NetworkException (com.xabber.android.data.NetworkException)1 OnResponseListener (com.xabber.android.data.connection.OnResponseListener)1 MessageItem (com.xabber.android.data.message.MessageItem)1 Request (com.xabber.xmpp.httpfileupload.Request)1 Slot (com.xabber.xmpp.httpfileupload.Slot)1 HttpClient (cz.msebera.android.httpclient.client.HttpClient)1 FileEntity (cz.msebera.android.httpclient.entity.FileEntity)1 DefaultHttpClient (cz.msebera.android.httpclient.impl.client.DefaultHttpClient)1 File (java.io.File)1 IQ (org.jivesoftware.smack.packet.IQ)1