With Retrofit 2, you can set a full URL in the annotation of a service method like : public interface APIService { @GET("http://api.mysite.com/user/list") Call<Users> getUsers(); } However, in my app, the URL of my webservices are not known at compile time, the app retrieves them in a downloaded file so i'm wondering how i can use Retrofit 2 with full dynamic URL. I tried to set a full path like :
Robolectricで書いたお試しコードですが、RetrofitでHTMLのスクレイピングをしてみました。HTMLのパーサーはJsoupを用いています。手元の実行環境はAndroid API16とRobolectric 2.4ですけど、サンプルは画面が無いのでほとんどバージョン関係なく動くと思う。 @RunWith(RobolectricTestRunner.class) public class RetrofitUsage { @Before public void setUp() throws Exception { // ./gradlew -i test を実行すると、Androidログが標準出力に書きだされる ShadowLog.stream = System.out; } @Test public void getJsoupDocuments() { RestAdapter
Migrate from Retrofit to Retrofit2 (Retrofit から Retrofit2 に移行する) retrofit2 が正式リリースされました。 retrofit/CHANGELOG.md at master · square/retrofit retrofit との後方互換性はありません。そのため maven の group id が com.squareup.retrofit2 になっています。 compile 'com.squareup.retrofit2:retrofit:2.0.0' Converter GSON などの Converter は別のモジュールに分割されました。 retrofit new RestAdapter.Builder() .setConverter(new GsonConverter(gson)) ... retrofit2
Retrofit 2.0: The biggest update yet on the best HTTP Client Library for Android Retrofit is one of the most popular HTTP Client Library for Android as a result of its simplicity and its great performance compare to the others. Anyway its weakness is there is no any straight way to cancel the ongoing transaction in Retrofit 1.x. If you want to do that you have to call it on Thread and kill it manu
たまたまChangeLogを読んだので、気になったポイントを紹介します。 Package名を変更した 3系になってcom.squareup.okhttpからokhttp3に変更されています。理由はJakeのブログに詳しく書かれていますが、要約すると、2系のコードと共存出来るようにすることで、部分的/段階的に3系のコードを取り入れることを可能にして、バージョンアップの負担を減らすことが目的のようです。 グローバルなconnection poolの仕組みがなくなった 2系は全てのOkHttpClientのインスタンスがグローバルなコネクションプールを共有していたらしいのですが(知らなかった... )、それがなくなりました。 そのため、3系では一つのOkHttpClientインスタンスをアプリケーション全体で使いまわすことが薦められています。 OkHttpClientが不変になった 2系のOkH
I am using OKHTTP client for networking in my android application. This example shows how to upload binary file. I would like to know how to get inputstream of binary file downloading with OKHTTP client. Here is the listing of the example : public class InputStreamRequestBody extends RequestBody { private InputStream inputStream; private MediaType mediaType; public static RequestBody create(final
Android で DefaultHttpClient が deprecated になって久しく、デフォルトだと HttpURLConnection を使うことになりました。 HttpURLConnection は http と https 間のリダイレクトを行わないというポリシーがあるらしく、リダイレクトした場合処理を行いません。 特にリダイレクトを有効にするオプションもないので、HttpURLConnection を使う場合は自分でリダイレクトのチェック処理を書く必要があります。 今開発しているアプリ( PhotoLinkViewer )でリダイレクトの結果をチェックしているのですが、http -> https -> http とリダイレクトするサイトがあったりして処理が結構めんどくさい。 ということで OkHttp という Square,Inc が作っているオープンソースのネットワー
業務で Android アプリを作成していると development (開発) サーバなどで所謂独自 (オレオレ) 証明書を使っていることがよくある。普通に HTTPS アクセスしに行くと SSLHandshakeException がスローされ失敗する。その為証明書検証をスキップして接続する必要が出てくる。当然本番環境ではそのような SSL 証明書は使用されないので、開発環境の為だけの 本来の開発と関係ない作業 をやらされるのが辛い。手っ取り早くやっつけたいところだ。 Volley でどうやるのか分からなかったので調べてみた。Volley.newRequestQueue() に詰める HurlStack インスタンスに対してオレオレ証明の検証をスキップする SSLSocketFactory を詰めるといいようだ。 private static SSLSocketFactory getA
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く