Restexpress support MatrixParam it?

27 views
Skip to first unread message

loui...@gmail.com

unread,
Jul 20, 2016, 3:53:49 AM7/20/16
to RestExpress
My project  register route with uri  "services/test/{id}/detail",then the server start successfully。
When i access this url with matrix param like "127.0.0.1:8081/services/test/1/detail;param1=1",
I found restexpress can not match the uri registered before.
I think UrlPattern can not support matrix parameters from path.
Could you please point out the mistakes here?
Thank you.

Todd Fredrich

unread,
Jul 20, 2016, 11:33:58 AM7/20/16
to RestExpress
You are correct. RestExpress does not support matrix parameter parsing. As I understand it, matrix parameters are not a standard--just a design idea from Tim Berners-Lee.

As far as a work around (other than the obvious switch to query-string parameters), you could write your own regex for the URL. Or you could supply multiple routes to the same controller method like this:

server.url("/services/test/1/detail", controller)
  .method(GET);

server.url("/services/test/1/detail;{detailMatrix}", controller)
  .method(GET);

I believe that would work, then you could parse the detailMatrix parameters in your controller method.

Hopefully that works for you,
--Todd
Reply all
Reply to author
Forward
0 new messages