Note that there are some explanatory texts on larger screens.

plurals
  1. POSpecification and correct use of (boolean) URI matrix parameters (and making them optional when using CXF/JAXB)?
    text
    copied!<p>I was wondering if the "proper" use of URI/URL <strong>matrix parameters</strong> was ever defined in a specification, such as an RFC or a W3 recommendation?</p> <p>In particular, I just joined a project where we use matrix parameters and a Java framework to implement a REST service. One of the matrix parameters we have for our REST service is a boolean one, much like <code>;sortByDate=true</code></p> <p>What bugged me about this one is that the Java framework we use apparently insists that boolean parameters are always passed in (i.e. you cannot make them optional/omit them; probably because they are converted to Java boolean type). I think that's a bit odd...</p> <p>I have to doublecheck what framework we use tomorrow (I think it is JAXB), but in the meantime I wondered if matrix parameters were defined in an official specification somewhere, and if such a specification made any mention of boolean parameters.</p> <p>So far I found a hint (though no mention of boolean matrix parameters) in <a href="http://www.w3.org/TR/html401/appendix/notes.html#h-B.2.2" rel="nofollow">Appendix B 2.2</a> of the W3's "<strong>HTML 4.01 Specification</strong>":</p> <blockquote> <p>We recommend that HTTP server implementors, and in particular, CGI implementors support the use of ";" in place of "&amp;" to save authors the trouble of escaping "&amp;" characters in this manner.</p> </blockquote> <p>And the "<strong><a href="http://www.w3.org/Submission/wadl/#x3-130002.6.1" rel="nofollow">Web Application Description Language</a></strong>" specification specifies:</p> <blockquote> <p>Boolean matrix parameters are represented as: '<code>;</code>' <code>name</code> when <code>value</code> is <code>true</code> and are omitted from <code>identifier</code> when <code>value</code> is <code>false</code></p> </blockquote> <p>What I haven't found is "<strong><em>the</em></strong>" specification for matrix parameters. Is there any? Does it mention how boolean matrix parameters should be used? If not, is there an established best practice?</p> <p>And, as a bonus question: can you omit boolean URL matrix parameters when using CXF (JAXB), or do you always have to specify them?</p> <p>Cheers! :)</p> <p><strong>Update:</strong> We're using <a href="http://cxf.apache.org/" rel="nofollow">CXF</a> (which apparently uses JAXB under the hood...)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload