Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Query parameters: http://example.com/apples?order=random&color=blue

Matrix parameters: http://example.com/apples;order=random;color=blue

  1. When should one use query parameters versus matrix parameters?
  2. Why can matrix parameters be used in the middle of a URL but query parameters cannot? For example: http://example.com/apples;order=random;color=blue/2006/archive
  3. If matrix parameters are a superset of query parameters, why not use them all the time?

You can read more about matrix parameters here: http://www.w3.org/DesignIssues/MatrixURIs.html

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
453 views
Welcome To Ask or Share your Answers For Others

1 Answer

The differences between Matrix parameters and Query Parameters are much more than just convention.

The main differences are:

urls with query params won't have their response cached by intermediaries/proxies (at present) matrix parameters may appear anywhere in path calculating the relative uri is different query params are generally abused to add new verbs instead of using existing methods on resources matrix parameters are not resources, they are aspects that help reference a resource in an information space that is difficult to represent within a hierarchy

I've written it up in more detail and with more references in Query vs. Matrix Parameters


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...