2017-02-22 65 views
-1

我有一個叫InjectDemoResource類中,我創建了一個方法getParam()是如下enter image description hereREST API矩陣PARAM註釋

正如你可以看到我已經將路徑設置爲/injectdemo/annotations,我用的@MatrixParam註釋在getParam()方法。

我使用REST API客戶端 - 郵差中,我輸入的網址按以下方式:

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

但我得到了以下錯誤:404 Not Found enter image description here

+0

使用';'而不是':'。 –

+0

嘗試使用此URL http:// localhost:8080/Messenger/webapi/injectdemo/annotations; param = value – alayor

+0

請閱讀[我如何問一個好問題?](http://stackoverflow.com/help/how-詢問),然後嘗試提出更多問題。不要將代碼發佈爲圖片! –

回答

1

使用;而不是:在URL中放置semicolon (;)在您的URI:

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

有關詳細信息,矩陣PARAMS如何工作,檢查RFC 6570

3.2.7. Path-Style Parameter Expansion: {;var}

路徑風格參數擴展,由分號(;) 操作者所指示的[...],是用於描述的URI 路徑參數,諸如path;propertypath;name=value有用。 [...]

0

這會修正這個錯誤。

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

確保你後/annotations