Java 问号(?)在jax rs中被%3F替换

Java 问号(?)在jax rs中被%3F替换,java,rest,web-services,jersey,jax-rs,Java,Rest,Web Services,Jersey,Jax Rs,在jax-rsjersey中调用API时,我必须传递一个参数。但这正转变成一些特殊的角色。 我声明了一个变量mCopy,根据某些条件,该变量要么为false,要么为true。 我的URI是 URI:- https://idcs-oda-xxxxxxx.com/api/v1/bots/pushRequests?copy=true 我的代码是 Response rawres = client.target("https://idcs-oda-xxxxxxx.com")

在jax-rsjersey中调用API时,我必须传递一个参数。但这正转变成一些特殊的角色。 我声明了一个变量
mCopy
,根据某些条件,该变量要么为false,要么为true。 我的URI是

URI:- https://idcs-oda-xxxxxxx.com/api/v1/bots/pushRequests?copy=true
我的代码是

Response rawres = client.target("https://idcs-oda-xxxxxxx.com")
                                .path("bots")
                                .path("pushRequests?copy="+mcopy")
                                .request().header("Authorization",access_token)
                                .post(null, Response.class);
它抛出错误

  https://idcs-oda-xxxxxxx.com/api/v1/bots/pushRequests%3Fcopy=false, status=404, reason=Not Found
实际上
pushRequests?copy=mCopy
正在转换为
pushRequests%3Fcopy=false


我怎样才能保持健康?符号本身?

您没有正确使用API。您要执行以下操作:

Response rawres = client.target("https://idcs-oda-xxxxxxx.com")
                                .path("bots")
                                .path("pushRequests")
                                .queryParam("copy", mcopy) // this is the change
                                .request().header("Authorization",access_token)
                                .post(null, Response.class);

您没有正确使用API。您要执行以下操作:

Response rawres = client.target("https://idcs-oda-xxxxxxx.com")
                                .path("bots")
                                .path("pushRequests")
                                .queryParam("copy", mcopy) // this is the change
                                .request().header("Authorization",access_token)
                                .post(null, Response.class);

copy=true
看起来是查询部分或URL,而不是路径的一部分。@Gereon-ya-Gereon,现在我明白了。
copy=true
看起来是查询部分或URL,而不是路径的一部分。@Gereon-ya-Gereon,现在我明白了。