android - How to prepend to the url of the API root in Retrofit / Can I have two Rest Adapters? -
this how set retrofit client.
restadapter.builder builder = new restadapter.builder(); builder.setendpoint(server.api_root); builder.setexecutors(executors.newfixedthreadpool(5), new scheduledthreadpoolexecutor(5)); restadapter restadapter = builder.build(); rest_client = restadapter.create(api.class);
however, of api endpoints i'm using http://example.com/ , others http://test.example.com/ should do?
actually, can have 2 adapters 2 different apis?
you have implement endpoint
sample: https://medium.com/@kevintcoughlin/dynamic-endpoints-with-retrofit-a1f4229f4a8d
if using 2.0 beta+ , endpoint renamed baseurl
also, take @ 2.0+ :
new: @url parameter annotation allows passing complete url endpoint.
Comments
Post a Comment