I\'m using Retrofit for REST web services my android project. It works fine overall untill the point I\'m trying to read several parameters from the return URL. For exapmle
You can try to get this data from Retrofit Callback. In your Retrofit Service declare method with Callback.
public interface YourService {
@GET("/url")
JsonElement get(Callback cb);
}
RestAdapter adapter = new RestAdapter.Builder().setEndpoint("http://foobar.com").build();
YourService service = adapter.create(YourService.class)
And then handle response url in Callback
service.createUser(new Callback() {
@Override
public void success(JsonElement jsonElement, retrofit.client.Response response) {
String url = response.getUrl();
// handle url
}
@Override
public void failure(RetrofitError error) {
}
});
Try to use OkHttpClient. Add dependency in build.gradle and modify RestAdapter
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
RestAdapter restAdapter = new RestAdapter.Builder()
...
.setClient(new OkClient(new OkHttpClient().setFollowSslRedirects(false /* or try true*/)))