我有一个名为 InjectDemoResource 的类,我在其中创建了一个方法 getParam()
如下
如你所见,我已将路径设置为 /injectdemo
和/annotations
,我用了@MatrixParam
getParam()
中的注释方法。
我正在使用 Rest API 客户端 - Postman,我通过以下方式输入 URL:
http://localhost:8080/Messenger/webapi/injectdemo/annotations:param=value
最佳答案
在 URL 中使用 ;
代替 :
:
http://localhost:8080/Messenger/webapi/injectdemo/annotations;param=value
有关矩阵参数如何工作的更多详细信息,请查看 RFC 6570 :
3.2.7. Path-Style Parameter Expansion: {;var}
Path-style parameter expansion, as indicated by the semicolon (
;
) operator [...], is useful for describing URI path parameters, such aspath;property
orpath;name=value
. [...]
关于java - Rest API Matrix 参数注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42403354/