【发布时间】:2018-10-12 07:40:18
【问题描述】:
所以我使用 CXF-RS 代理功能来创建可重用的 REST 客户端,我将在多个应用程序中使用它。所以我有一个界面,类似的东西:
@Path("/hello")
public interface HelloService {
@GET
@Path("sayHello")
String sayHello(@QueryParam("name") String name);
}
我正在创建客户端:
JAXRSClientFactory.create(address, HelloService.class, Collections.singletonList(JacksonJsonProvider.class), true)
但现在我需要根据应用程序的配置向请求发送一个额外的查询参数。我不想更改接口 HelloService 而是使用某种过滤器来处理这个问题。我看到了ClientRequestFilter,但我不知道它是否是正确的工具以及我应该如何将它添加到代理(我看到的所有教程都使用ClientBuilder.newClient() 而不是代理)。
提前谢谢你。
【问题讨论】: