将参数传递给 url
Passing parameters to a url
我正在通过 jax-rs 端点调用 jsp 页面,如下所示。
public String logout(@Context HttpServletRequest request,@DefaultValue("Empty Details") @QueryParam("logoutNotification") String logoutNotification,
@QueryParam("id_token_hint") String id_token_hint) {
Response response= Response.status(200).entity(logoutNotification).build();
if(response.getEntity().toString().equals("True")){
return "<html><head><script>\n" +
"window.open(\"https://localhost:9443/carbon/authenticationendpoint/test.jsp\");</script></head><body></body></html>";
}
else {
return null;
}
问题是我需要从这个端点向“https://localhost:9443/carbon/authenticationendpoint/test.jsp”传递一些参数。我该怎么做?
我可以从端点将它作为查询参数传递吗?请给我建议。
谢谢
我对 RESTful 网络服务了解不多。但是在 url 中,如果你想传递参数,它可以作为 <url URL>?par1=val1&par2=val2
如果你的代码打开一个新的 window 那么这将起作用。
希望对您有所帮助。
示例:https://localhost:9443/carbon/authenticationendpoint/test.jsp?name=Joe&age=24
我正在通过 jax-rs 端点调用 jsp 页面,如下所示。
public String logout(@Context HttpServletRequest request,@DefaultValue("Empty Details") @QueryParam("logoutNotification") String logoutNotification,
@QueryParam("id_token_hint") String id_token_hint) {
Response response= Response.status(200).entity(logoutNotification).build();
if(response.getEntity().toString().equals("True")){
return "<html><head><script>\n" +
"window.open(\"https://localhost:9443/carbon/authenticationendpoint/test.jsp\");</script></head><body></body></html>";
}
else {
return null;
}
问题是我需要从这个端点向“https://localhost:9443/carbon/authenticationendpoint/test.jsp”传递一些参数。我该怎么做? 我可以从端点将它作为查询参数传递吗?请给我建议。 谢谢
我对 RESTful 网络服务了解不多。但是在 url 中,如果你想传递参数,它可以作为 <url URL>?par1=val1&par2=val2
如果你的代码打开一个新的 window 那么这将起作用。
希望对您有所帮助。
示例:https://localhost:9443/carbon/authenticationendpoint/test.jsp?name=Joe&age=24