【问题标题】:Retrofit Request on IP Address with Port对带有端口的 IP 地址的改造请求
【发布时间】:2017-06-27 03:56:07
【问题描述】:

我正在使用 Retrofit 解析数据。由于我以前将 BASE URL 和 END POINTS 提供给改造请求,我不知道如何将 IP ADDRESS 提供为 BASE URL。

我想使用如下网址:http://xxx.xxx.xx.xxx:xxxx/

有什么建议我如何设置我的 BASE URL 和 END POINT

【问题讨论】:

    标签: android networking request retrofit retrofit2


    【解决方案1】:

    我在改造 2 中使用的内容如下所示。

    URL_BASE = http://192.168.1.11:8080

    Retrofit retrofit = new Retrofit.Builder()
                    .client(httpClient)
                    .baseUrl(URL_BASE + "/")
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();
    

    端点:http://192.168.1.11:8080/users

    @GET("users")
    Call<Response> getUser();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-04
      • 1970-01-01
      • 2019-03-05
      • 1970-01-01
      • 2011-07-31
      • 2019-05-31
      • 2023-03-03
      • 2018-08-21
      相关资源
      最近更新 更多