okhttp

Does OkHttp support HTTP/2 server push?

两盒软妹~` 提交于 2019-12-24 08:34:29
问题 I am developing an Android video streaming application using the OkHttp library and HTTP/2. I am investigating the possibility of using the server push functionality of the HTTP/2 protocol, but I am not sure whether OkHttp supports it or not. I have a basic server implementation to test HTTP/2 push, which works without problems on the chrome browser (i.e., pushed content is stored in the cache and retrieved from the cache by the browser). When I use the Android application with the OkHttp

Android Retrofit GET @Query ArrayList

人走茶凉 提交于 2019-12-24 04:51:12
问题 I am trying to consume a GET API that expects in its query params list an array of strings. I am using Retrofit for the task. In the API interface, I have the following defined: @GET("user/explore") Observable<User> fetchUsers(@Query("who") String who, @Query("category") ArrayList<String> categories); I am using Timber for logging and in the console, I see the request is made like the following: http://192.168.2.208:3000/api/v1/user/explore?who=SOME_USER&category=SOME_CATEGORY The expected

Android Retrofit GET @Query ArrayList

青春壹個敷衍的年華 提交于 2019-12-24 04:51:04
问题 I am trying to consume a GET API that expects in its query params list an array of strings. I am using Retrofit for the task. In the API interface, I have the following defined: @GET("user/explore") Observable<User> fetchUsers(@Query("who") String who, @Query("category") ArrayList<String> categories); I am using Timber for logging and in the console, I see the request is made like the following: http://192.168.2.208:3000/api/v1/user/explore?who=SOME_USER&category=SOME_CATEGORY The expected

Exceptions with okHttp and SPDY

寵の児 提交于 2019-12-23 21:11:29
问题 I have an Android Application using okHttp to do the communication with my server. I do some detailed error handling on the client side, reported to BugSense, and I've gotten a few confusing IOExceptions that I was hoping could be explained to me. The exceptions are: 1. stream was reset: CANCEL 2. connect failed: ENETUNREACH (Network is unreachable) 3. stream was reset: REFUSED_STREAM 4. Hostname 'myversion-dot-myapplication.appspot.com' was not verified I don't recall seeing the first three

Import swagger-codegen project into existing Android project

亡梦爱人 提交于 2019-12-23 17:05:47
问题 Im trying to integrate a "module"-project generated by swagger-codegen, into my Android project. Haven't worked that much with gradle before and the swagger-codegen creates a quite messy build.gradle from my point of view. I have a hard time finding documentation on how to do this. And I feel a bit lost. I used this method described in the FAQ mvn clean package java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ -i http://petstore.swagger.io/v2/swagger.json \ -l

Retrofit image upload using Base64 in android

烈酒焚心 提交于 2019-12-23 09:34:50
问题 I am trying to upload the image using retrofit in Base64 format. To convert bitmap to Base64, public static String convertImageToStringForServer(Bitmap imageBitmap){ ByteArrayOutputStream stream = new ByteArrayOutputStream(); if(imageBitmap != null) { imageBitmap.compress(Bitmap.CompressFormat.JPEG, 60, stream); byte[] byteArray = stream.toByteArray(); return Base64.encodeToString(byteArray, Base64.DEFAULT); }else{ return null; } } I do not want to upload the image using Typedfile. My request

com.android.volley.NoConnectionError after pausing app

╄→гoц情女王★ 提交于 2019-12-23 07:27:16
问题 I'm writing my app with Google Volley and Gson to talk to a REST service with OkHttp as HTTP-Stack. That works good most of the time but when I pause my app and return to it the HTTP requests don't work with this Exception: 09-08 19:29:19.611: E/ASDF(21827): com.android.volley.NoConnectionError: java.io.EOFException 09-08 19:29:19.611: E/ASDF(21827): at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:125) 09-08 19:29:19.611: E/ASDF(21827): at com.android.volley

Passing arrays in multipart POST using Okhttp

穿精又带淫゛_ 提交于 2019-12-23 03:14:14
问题 I'm building an app that requires an API call that has array in its POST body request. I'm using OkHttp 2.6 to request for API. The request in Postman looks like this: I have tried several ways of writing RequestBody in order to achieve this, First method RequestBody requestBody = new MultipartBuilder() .type(MultipartBuilder.FORM) .addFormDataPart("app_token", MY_TOKEN) .addFormDataPart("user_id", 377) .addFormDataPart("group_id", String.valueOf(groupId)) .addFormDataPart("key_id", deals

Importing Picasso and OkHttp in Eclipse

冷暖自知 提交于 2019-12-23 00:29:16
问题 I need to expose some Picasso resources to satisfy a rather strange request. For this I need to import Picasso as a library project instead of a compiled jar. I've created a new Android Project and copied the contents of picasso\picasso\src\main\java (cloned master) to the src folder. Picasso uses OkHttp so I downloaded the latest release jar (2.3.0) and put it in the libs folder of the Picasso project; added it to the build path; selected the jar in the build path "Order and Export"

Android Retrofit 2 file upload is not working

旧时模样 提交于 2019-12-22 14:17:15
问题 I want to develop an app which is upload any type of file to sever. I got source code. But it is working only for images. And only upload below 2 MB size of image files. I want to upload all type of files. Please help me. My codes are shown below. MainActivity.java public class MainActivity extends AppCompatActivity { Service service; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btn = (Button)