Rest API Matrix参数注释 [英] Rest API Matrix param annotation
问题描述
我有一个名为InjectDemoResource的类,在其中创建了一个方法 getParam()
,如下所示
I have a class called InjectDemoResource in which I have created a method getParam()
which is as below
如您所见,我已将路径设置为 / injectdemo
和 / annotations
,我在 getParam()
方法中使用了 @MatrixParam
注释。
As you can see I have set the path to /injectdemo
and /annotations
, I used the the @MatrixParam
annotation in the getParam()
method.
我正在使用Rest API客户端-邮递员,我以以下方式在其中键入URL:
I am using Rest API client - Postman in which i typed the URL in the following way:
http://localhost:8080/Messenger/webapi/injectdemo/annotations:param=value
但我遇到了以下错误: 404未找到
But I got the following error : 404 Not Found
推荐答案
使用;
而不是URL中的:
:
Use ;
instead of :
in the URL:
http://localhost:8080/Messenger/webapi/injectdemo/annotations;param=value
有关矩阵参数如何工作的更多详细信息,请查看 RFC 6570 :
For more details, on how matrix params work, check the RFC 6570:
路径样式参数扩展,以分号(;
)
运算符[...],对于描述URI
路径参数(例如 path; property
或 path; name = value
。 [...]
Path-style parameter expansion, as indicated by the semicolon (;
)
operator [...], is useful for describing URI
path parameters, such as path;property
or path;name=value
. [...]
这篇关于Rest API Matrix参数注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!