gpt4 book ai didi

java - 从 jersey @PathParameter 中的 URL 获取片段(值哈希 '#')

转载 作者:行者123 更新时间:2023-11-30 08:44:27 25 4
gpt4 key购买 nike

如何使用 Jersey @PathParameter 从 URL 获取片段(值哈希“#”)?

@Path("Step2")

public class AdResource {

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{password:.+}/")
public String doResc(@PathParam("password") String pwd){
System.out.println(pwd);
}

我的网址是 http://localhost:8080/Sample/webapi/Step2/Password@12#

但密码将显示为“Password@12”,只是缺少哈希 (#)..

最佳答案

尝试编码/解码 url。对于javascript:编码URI(uri)

然后使用 URLDecoder 在 java 中对其进行解码

关于java - 从 jersey @PathParameter 中的 URL 获取片段(值哈希 '#'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33752988/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com