java - Rest API Matrix 参数注释

标签 java rest postman

我有一个名为 InjectDemoResource 的类,我在其中创建了一个方法 getParam()如下enter image description here

如你所见,我已将路径设置为 /injectdemo/annotations ,我用了@MatrixParam getParam() 中的注释方法。

我正在使用 Rest API 客户端 - Postman,我通过以下方式输入 URL:

http://localhost:8080/Messenger/webapi/injectdemo/annotations:param=value

但我收到以下错误:404 Not Found enter image description here

最佳答案

在 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. [...]

关于java - Rest API Matrix 参数注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42403354/

相关文章:

每次我尝试在 Jenkins 上运行测试用例时都会出现 Java 错误

node.js - 休息 |智威汤逊 |授权 : How To Verify Authorities For Secure Resources

node.js - 使用 Node.js 扩展现有的 RESTful API

java - 使用 service/dao 层模式的 Android 项目 "back-end"的最佳架构

node.js - 测试中表达 body-parser utf-8 错误

java - 将 ArrayList<String> 转换为 String[] 数组

java - Dataweave 停止从输入负载端的查询中拾取 Java linkedList 数据

java - 使用apache Camel从队列到soap服务器的数据传输

go - 使用 auth0 获取登录 acess_token 给 postman

laravel - 如何使用 laravel 在 API 期间进行调试