我需要解析以下URL中的参数:http: //mysite.com/customer/token/name/customerName
所以在上面的例子中有两个参数,customer => token和name => customerName.如何从上面的url中检索参数(键的名称)?
谢谢.
你可以这样做:
router.attach("/name/{name}", HelloWorldResource.class);
Run Code Online (Sandbox Code Playgroud)
然后访问它像:
String m = (String)this.getRequestAttributes().get("name");
Run Code Online (Sandbox Code Playgroud)
这叫做模板.