How to get the response URL from Retrofit?

前端 未结 6 849
感情败类
感情败类 2021-01-05 15:48

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

6条回答
  •  时光说笑
    2021-01-05 16:11

    I have solve the problem.Here is my solution:

    Define a request

    @GET 
    Call getSend(@Url String url);
    

    and send

    Api.get(WXApi.class).getSend(ip).enqueue(new Callback() {
    
        @Override
        public void onResponse(Call call, Response response) {
    
            Log.d(TAG,"response.raw().request().url();"+response.raw().request().url());}
    
        @Override
        public void onFailure(Call call, Throwable t) {
    
        }
    });
    

提交回复
热议问题