Tomcat, JAX-RS, Jersey, @PathParam: how to pass dots and slashes?

前端 未结 4 1473
我在风中等你
我在风中等你 2020-12-18 21:52

Having a method like this:

@GET @Path(\"/name/{name}\")
@Produces(MediaType.TEXT_PLAIN)
public String getProperty(@PathParam(\"name\") String name) {
                


        
4条回答
  •  误落风尘
    2020-12-18 22:31

    Try specifying the encoding type, the following works for me with /name/test.%252Ftest:

    System.out.println(URLDecoder.decode(name, "UTF-8"));
    return URLDecoder.decode(name, "UTF-8");
    

提交回复
热议问题