Rest API 矩阵参数注释
Rest API Matrix param annotation
我有一个名为 InjectDemoResource 的 class,我在其中创建了一个方法 getParam()
,如下所示
如您所见,我已将路径设置为 /injectdemo
和 /annotations
,我在 getParam()
方法中使用了 @MatrixParam
注释。
我正在使用 Rest API 客户端 - 邮递员,我在其中按以下方式输入 URL:
http://localhost:8080/Messenger/webapi/injectdemo/annotations:param=value
但我收到以下错误:404 Not Found
这将修复错误。
http://localhost:8080/Messenger/webapi/injectdemo/annotations;param=value
确保在 /annotations
之后的 URI 中放置 semicolon ( ; )
在 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 as path;property
or path;name=value
. [...]
我有一个名为 InjectDemoResource 的 class,我在其中创建了一个方法 getParam()
,如下所示
如您所见,我已将路径设置为 /injectdemo
和 /annotations
,我在 getParam()
方法中使用了 @MatrixParam
注释。
我正在使用 Rest API 客户端 - 邮递员,我在其中按以下方式输入 URL:
http://localhost:8080/Messenger/webapi/injectdemo/annotations:param=value
但我收到以下错误:404 Not Found
这将修复错误。
http://localhost:8080/Messenger/webapi/injectdemo/annotations;param=value
确保在 /annotations
semicolon ( ; )
在 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
. [...]