英文:
Can I make a path like that
问题
你好,我有一个类似这样的类:
@Path("infected")
public class Resource{
@GET
@Path("city/{infected}")
public Response selectInfectadosCiudad(@PathParam("infected") String nombre){
...
}
}
但是当我尝试访问 .../infected/city/123,例如,它给我返回一个 404 错误,所以我猜想不能调用 city/{infected},也就是说在 PathParam 之前不能使用 city/,我理解得对吗?
英文:
Hello guys I a class like that:
@Path("infected")
public class Resource{
@GET
@Path("city/{infected}")
public Response selectInfectadosCiudad(@PathParam("infected") String nombre){
...}
}
But when I try to go to .../infected/city/123 for example it gives me a 404, so I suppose that you can't call city/{infected} I mean you cant use city/ before the Pathparam am I correct?
答案1
得分: 0
你可以尝试在路径之前添加 '/'
@Path("/infected")
public class Resource{
@GET
@Path("/city/{infected}")
public Response selectInfectadosCiudad(@PathParam("infected") String nombre){
...}
}
我不确定这是否有效,但可以尝试一下
英文:
Can you try to add '/' before the path
@Path("/infected")
public class Resource{
@GET
@Path("/city/{infected}")
public Response selectInfectadosCiudad(@PathParam("infected") String nombre){
...}
}
I'm not sure if this will work or not but try it
专注分享java语言的经验与见解,让所有开发者获益!
评论